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,
 
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM