Vue技术栈开发实战笔记(二)-------路由的基础

1. 路由的详解:

     1)router-link和router-iview组件:

     2)路由配置:

             a.动态路由:

             b.嵌套路由:

             c.命名路由:

             f.命名视图:

     3)重定向和别名:

     4)js操作路由(即编程式的导航): 

           a. 返回/前进一页:返回:this.$router.go(-1)、this.$router.back()。前进:this.$router.go(1)。

           b. 跳转到其他页:

                      this.$router.push("/parent")。

                      this.$router.push({name:"parent",query:{id:001}),即浏览历史纪录保存着,query是参数。

                      this.$router.push({path:`/argu/${name}`})    ,针对 path: '/argu/:name',该路由。

                      this.$router.push({name:"/parent",params:{name:"ace"}) , 带参数跳转。

           c. 用其他页替换本页:this.$router.replace("/about")或this.$router.replace({name:"parent"}),即浏览历史纪录没有了。

猜你喜欢

转载自blog.csdn.net/qq_42231156/article/details/82346968