摘要: 一、watch监听路由的方法 通过watch监听,当路由发生变化的时候执行。 方法一: watch:{ $router(to,from){ console.log(to.path) } } 方法二: watch: { $route: { handler: function (val, oldVal) 阅读全文
posted @ 2020-11-27 14:05 小那 阅读(9255) 评论(0) 推荐(1) 编辑
摘要: 一、使用 watch: { mydata(val, newval) { console.log(val) console.log(newval) } } 二、属性详解 immediate handler deep (1)immediate和handler watch特点:当值第一次绑定时,不会执行监 阅读全文
posted @ 2020-11-27 13:32 小那 阅读(2310) 评论(0) 推荐(0) 编辑
摘要: 1、watch watch的使用方法 (1)简单监听 (2)深度监听 (3)监听数据变化并执行某个方法 (1)简单监听 watch: { mydata(val, newval) { console.log(val) console.log(newval) } } (2)深度监听 watch: { m 阅读全文
posted @ 2020-11-27 11:51 小那 阅读(430) 评论(0) 推荐(0) 编辑