Vue常用知识点

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011565547/article/details/78265963

获取当前绑定的元素
vm.$el = document.querySelector('.app');
不能更改绑定对象

获取当前绑定的数据
vm.$data = {message:{name:1}}
更换data对象刷新视图,尽量不去更换

监控模型的变化

vm.$watch('message', function (newVal,oldVal) {
    console.log(newVal,oldVal);
});

猜你喜欢

转载自blog.csdn.net/u011565547/article/details/78265963
今日推荐