父向子傳值:
//父組件
<selectionGroup v-for="item in tab" :item="item"></selectionGroup>
//子組件
<GroupItem v-for="section in item"></GroupItem>
//子組件接收值
props: {
item: {
type: Object
},
子向父傳值:
//子組件
<input type="radio" @click="check(feature.description)"/>
check(description){
this.$emit('description',description);//第一個值是event,第二個值是 data
},
//父組件
<GroupChild @description="description"></GroupChild>
methods: {
description(description){
},
路由傳參:
<template>
<list v-for="item in productList" :item="item" @details = "details(item)"></list>
</template>
<script>
details (item) {
router.push({
name: 'details',
params:{item:item}
})
}
</script>
//接收
Value: this.$route.params.item,