vue-route
1.vue-router安装下载
npm install vue-router --save
2.Vue实例中引入
3.配置router
4.路由跳转
this.$router.push({path:'/my'}) path为跳转路径
this.$router.push({name:'My'}) 用name作为路由跳转
this.$router.push({name:'My',params:{name:'张三'}}) 将要传递的参数放在params(还可通过query)传过去,通过this.$route.params.name获取
this.$router.replace() 此方法不会产生历史记录,push方法都会有历史记录
this.$router.go(num) 向前或向后跳转num个页面,比如this.$router.go(-1) 就是返回上一页
5.获取通过路由传递的参数