vue-router 基本使用

转载自:https://blog.csdn.net/qq_31967569/article/details/91546294

观看笔记:

其实大部分内容,都已经了然于胸,理解起来也比较简单。

1、大前提

<router-link :to="页面地址">

<router-view>页面实际显示的内容</router-view>

 

2、定义router.js

定义:routes:[ {path,component}],然后生成router,注册到VUE根实例

 

3、动态路由: :id

4、嵌套路由:children

5、路由变化监听:

watch{

$router(to,from):{

}

}

posted @ 2021-04-21 11:43  墨晓溪2288  阅读(46)  评论(0编辑  收藏  举报