vue中watch深度监听

监听基本类型的都是浅度监听
watch的深度监听,监听复杂类型都是深度监听(funciton ,arrat ,object)
//    监听对象
data(){
    return {
        a:{
            b:10,
            c:20
        }
    }
},
    watch:{
        a:{
            handler(a,b,c){
                console.log(a)
                console.log(b)
            },
                deep:true // 必须加这个属性
        }

猜你喜欢

转载自www.cnblogs.com/qdwds/p/11706954.html