Skip to content

Commit 110362c

Browse files
committed
还是去掉 watcher 这部分吧
1 parent 387a85d commit 110362c

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

src/v2/guide/migration-vue-router.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,23 +255,6 @@ export default {
255255
}
256256
```
257257

258-
或者,如果确信该 query 是个数组,不用担心破坏 $route 对象的"原始性",对 `$router.query.users` 设置一个 watcher 是个一劳永逸的方法:
259-
260-
```javascript
261-
export default {
262-
// ... 其他组件选项
263-
watch: {
264-
// ... 其他 watcher
265-
'$route.query.users': {
266-
handler(val) {
267-
this.$route.query.users = Array.isArray(val) ? val : [val]
268-
},
269-
immediate: true
270-
}
271-
}
272-
}
273-
```
274-
275258
## Route 匹配
276259

277260
路由匹配现在使用 [path-to-regexp](https://github.com/pillarjs/path-to-regexp) 这个包,这将会使得工作与之前相比更加灵活。

0 commit comments

Comments
 (0)