1、父组件传参,子组件接收 ,子组件 props 处理引用类型代码:
重点是:引用类型监听
props: { disabled: { type: Boolean, default: false, }, value: { type: String, default: '', }, },
在计算属性中获取
computed :{
setSelectVal() {
return this.value
},
}
在计算属性中 记得需要 要return 把值 传出去
在watch 中监听他的动态
watch:{
setSelectVal: (newV, oldV) => {
console.log('1', newV)
},
}