vue-router动态传值、get传值
作者:互联网
一、动态传值
import Home from './components/Home.vue';
// 1. 配置路由
nst routes = [
{ path: '/home/:id', component: Home },
]
//2. 页面配置跳转
<router-link :to="'/home/'+key"> {{item}}</router-link>
//3. 新页面获取值
this.$route.params
一、get传值
import Home from './components/Home.vue';
// 1. 配置路由
nst routes = [
{ path: '/home', component: Home },
]
//2. 页面配置跳转
<router-link :to="'/home?id='+key"> {{item}}</router-link>
//3. 新页面获取值
this.$route.query
标签:vue,get,home,跳转,新页面,Home,router,传值 来源: https://www.cnblogs.com/rzl795/p/15002727.html