- query
//router.js
{
path: '/edit',
component: resolve =>void(require(['../components/form/Edit.vue'], resolve)),
}
//go
this.$router.push({
path: '/edit',
query: {
id: 6,
},
})
//edit页面
//url /edit?id=6
console.log(this.$router.query)//{id: "6"}
- hash
//router.js
{
path: '/edit',
component: resolve =>void(require(['../components/form/Edit.vue'], resolve)),
}
this.$router.push({
path: '/form/edit/',
hash: '6',
})
//edit页面
//url /edit#6
console.log(this.$router.hash)//"#6"
- params
//router.js
{
path: '/edit/:id',
component: resolve =>void(require(['../components/form/Edit.vue'], resolve)),
}
//go
this.$router.push({
path: '/edit/6',
})
//edit页面
//url /edit/6
console.log(this.$router.params)//{id: "6"}