vue2.0父向子传参,子向父传参,路由传参
生活随笔
收集整理的這篇文章主要介紹了
vue2.0父向子传参,子向父传参,路由传参
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
父向子傳值:
//父組件
<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, ? ?
轉載于:https://www.cnblogs.com/lonelyGentleman/p/6730849.html
總結
以上是生活随笔為你收集整理的vue2.0父向子传参,子向父传参,路由传参的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python Day11
- 下一篇: vue.js 三(数据交互)isomor