From f7331951b704bbe680ac51d017d6a86a87a4c0c1 Mon Sep 17 00:00:00 2001 From: theluyuan <1162963624@qq.com> Date: Wed, 12 May 2021 10:10:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B5=8C=E5=A5=97=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/admin.vue | 4 ++-- src/pages/sitteng.vue | 44 +++++++++++++++++++++++++++++++++++++++++++ src/router/index.js | 25 ++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 src/pages/sitteng.vue diff --git a/src/pages/admin.vue b/src/pages/admin.vue index dfb651b..c5d74a3 100644 --- a/src/pages/admin.vue +++ b/src/pages/admin.vue @@ -59,8 +59,8 @@ export default { // params console.log(1) // this.$router.push({path: '/params/123' }) - this.$router.push({name:"params",params:{id:123,name:111,aaa:111}}) - // this.$router.push("/") + // this.$router.push({name:"params",params:{id:123,name:111,aaa:111}}) + this.$router.push("/sitteng/user") }, replace(){ // 不能回退 会替换当前路由 (当前路由被删除 用跳转之后的代替) diff --git a/src/pages/sitteng.vue b/src/pages/sitteng.vue new file mode 100644 index 0000000..7c4c1b7 --- /dev/null +++ b/src/pages/sitteng.vue @@ -0,0 +1,44 @@ + + + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index b2cc9a2..97b2185 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -14,6 +14,31 @@ const routes = [ next() }, component: admin }, + { + path:"/sitteng", + component: () => import("../pages/sitteng.vue"), + children:[ + { + path:"index", + component: () => import("../views/index.vue"), + meta:123, beforeEnter: (to, from, next) => { + // ... + console.log("路由独享") + next() + } + + }, + { + path: "user", + component: () => import("../views/user.vue") + }, + { + path:"admin", + component: () => import("../pages/admin.vue") + } + + ] + }, { path: "/params",meta:"admin", name: "params", component: () => import("../pages/params.vue") } // ()=>import('') 按需加载 路由异步加载 ] // path