赞
踩
-------------------父组件:----------------- <router-view @getShopCode='getShopCode'></router-view> methods:{ getShopCode(value){ conso.log(value); } } -------------------子组件:----------------- methods:{ goShopList(value){ this.$emit('getShopCode',value) this.$router.push({name:'shopList'}); } }
2.父组件发生变化导致子组件变化
父组件:
//inputValue为传递给子组件的值
<router-view :inputValue='inputValue'></router-view>
子组件:
watch:{
inputValue:function(value){
console.log(value)
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。