在子组件内深度监听值改变,调用加载方法
父组件
<tree-select-edit
:inputValue = "inputValue"
:fatherId = "contractSectId"
/>
子组件
<div
class="filter-input searchinput"
:opendialog="inputValue"
:constractId="fatherId"
>
</div>
///
props: {
inputValue: {
type: Boolean,
default: false
},
fatherId: {
type: String
}
},
深度监听fatherid的改变,调用数据接口事件
watch: {
fatherId: {
handler(val) {
this.getPartInfo()
},
immediate: true,
deep: true
}
},
methods: {
getPartInfo() {
listPartialTree({
teamId: this.addEventForm.teamId,
projectId: this.addEventForm.projectId,
contractSectId: this.fatherId
}).then(res => {
this.partOptions = res.data
})
}
}