vue父组件的值刷新后子组件不刷新
父组件:<pick-country v-show="modal_show" @func="getMsgFromSon(arguments)" :content="pick_content_show"></pick-country>method方法//组件传值getMsgFromSon(data){const that = this;setTimeout((...
·
1.通过@func绑定事件,$emit('func',[])
父组件:
<pick-country v-show="modal_show" @func="getMsgFromSon(arguments)" :content="pick_content_show"></pick-country>
method方法
//组件传值
getMsgFromSon(data){
const that = this;
setTimeout(() => { that.modal_show = data[0][0] }, 10)
setTimeout(() => { that.area_id = data[0][1] == '' ? that.area_id : data[0][1]}, 10)
},
子组件
setTimeout(() => { that.$emit('func',[that.modal_show, '']) }, 500)
2.通过prop属性,在子组件watch监听该属性的变化
watch: {
'value': {
handler (newVal) {
this.currentValue = newVal
},
deep: true,
immediate: true,
},
},
更多推荐
所有评论(0)