This commit is contained in:
theluyuan 2021-07-07 17:08:47 +08:00
parent d3d64cd25e
commit 29736567e8
3 changed files with 17 additions and 5 deletions

View File

@ -32,7 +32,7 @@ const routes = [
{ {
path: '/index', component: index, children: [ path: '/index', component: index, children: [
{ {
path: 'foo', component: foo, children: [{ path: 'foo/:name/:age', name:"foo", component: foo, children: [{
path: 'aaa', component: bar path: 'aaa', component: bar
}] }]
}, },

View File

@ -12,8 +12,17 @@
export default { export default {
methods:{ methods:{
getzhi(){ getzhi(){
// let a = ""
// let b = 18;
// // let str = "" + a + "" + b
// //
// let str = `${a}${b}`
// console.log(str)
// url // url
let zhi = this.$route.query // params url
let zhi = this.$route.params
console.log(zhi) console.log(zhi)
} }
} }

View File

@ -4,8 +4,6 @@
<el-menu <el-menu
default-active="2" default-active="2"
class="el-menu-vertical-demo menu" class="el-menu-vertical-demo menu"
@open="handleOpen"
@close="handleClose"
> >
<el-menu-item index="2" @click="toindex"> <el-menu-item index="2" @click="toindex">
<i class="el-icon-menu"></i> <i class="el-icon-menu"></i>
@ -31,10 +29,15 @@ export default {
this.$router.push("/index") this.$router.push("/index")
}, },
tobar(){ tobar(){
// "/index/bar" path
this.$router.push("/index/bar") this.$router.push("/index/bar")
}, },
tofoo(){ tofoo(){
this.$router.push("/index/foo") // { name } name
// params 使 使 path
// this.$router.push({ path:"/index/foo",params:{name:"111"} })
this.$router.push({ name:"foo",params:{name:"aaaa",age:18} })
} }
}, },
}; };