Vue对变量的监控

Vue对变量的监控

 watch: {
                a(val, oldVal) {//普通的watch监听
                    if (val == "1") {
                        $('#myModal').modal();
                    }
                    else {
                        $('#myModal').modal('hide');
                    }
                }
            }

 Vue对于变量的深度监控

 watch: {
            item1: {
                handler: function (val) {
                    alert("改变了")
                },
                deep: true
            }
        }
原文地址:https://www.cnblogs.com/sexintercourse/p/9817333.html