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,
	}, 
 },
Logo

前往低代码交流专区

更多推荐