Vue动态路由 1、不同路由传值:动态路由 1、配置动态路由 routes: [ // 动态路径参数 以冒号开头 { path: '/user/:id', component: User } ] 2、在对应的页面 this.$route.params获取动态路由的值 var aid=this.$route.params.aid; this.$route.query //获取get传值 //第一种跳转方式 // this.$router.push({ path: 'news' }) // this.$router.push({ path: '/content/495' }); //另一种跳转方式 // { path: '/news', component: News,name:'news' }, // router.push({ name: 'news', params: { userId: 123 }}) this.$router.push({ name: 'news'}) https://router.vuejs.org/ vue路由配置: 1.安装 npm install vue-router --save / cnpm install vue-router --save 2、引入并 Vue.use(VueRouter) (main.js) import VueRouter