我要实现的效果是,输入框都有值,按钮是黄色,只有有一项为空,按钮置灰。
<div :class="noKValue == true ? 'backffcc33':'backccc' " >按钮</div>
watch: {
// 监听 只要有一项为空 底部按钮就是灰色
对象名:{
handler(nv,ov){
let noKValue = true
// console.log(nv,'nv')
for (const key in nv) {
// console.log(nv[key],key,'key')
if(nv[key] && nv[key].trim(){
noKValue = true
}else{
noKValue = false
}
}
this.noKValue = noKValue
},
immediate:true,
deep:true
}
},