Sky

windows中path定位出现问题,改换另一种方法,但是局限性颇高,路由需要按照规则写

...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
71 </template> 71 </template>
72 72
73 <script> 73 <script>
74 -import path from "path"; 74 +// import path from "path";
75 75
76 export default { 76 export default {
77 name: "SidebarItem", 77 name: "SidebarItem",
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
111 return false; 111 return false;
112 }, 112 },
113 resolvePath(...paths) { 113 resolvePath(...paths) {
114 - return path.resolve(this.basePath, ...paths); 114 + return this.basePath + "/" +paths[0]
115 }, 115 },
116 OneShowingChild(children) { 116 OneShowingChild(children) {
117 this.onlyOneChild = children; 117 this.onlyOneChild = children;
......
1 -import Layout from '../layout' 1 +import Layout from '@/layout'
2 const Login = () => import('@/views/login') 2 const Login = () => import('@/views/login')
3 const Notfound = () => import('@/views/404') 3 const Notfound = () => import('@/views/404')
4 /** 4 /**
...@@ -27,7 +27,7 @@ const Notfound = () => import('@/views/404') ...@@ -27,7 +27,7 @@ const Notfound = () => import('@/views/404')
27 **/ 27 **/
28 export default [ 28 export default [
29 { path: '/login', component: Login, hidden: true }, 29 { path: '/login', component: Login, hidden: true },
30 - { path: '/404', component: Notfound, hidden: true }, 30 + { path: '*', component: Notfound, hidden: true },
31 { 31 {
32 path: '/', 32 path: '/',
33 component: Layout, 33 component: Layout,
...@@ -44,12 +44,19 @@ export default [ ...@@ -44,12 +44,19 @@ export default [
44 { 44 {
45 path: '/form', 45 path: '/form',
46 component: Layout, 46 component: Layout,
47 + meta: { title: '表单', icon: 'form' },
47 children: [ 48 children: [
48 { 49 {
49 path: 'index', 50 path: 'index',
50 name: 'Form', 51 name: 'Form',
51 component: () => import('@/views/form/index'), 52 component: () => import('@/views/form/index'),
52 meta: { title: '表单', icon: 'form' } 53 meta: { title: '表单', icon: 'form' }
54 + },
55 + {
56 + path: 'index2',
57 + name: 'Form2',
58 + component: () => import('@/views/form/index'),
59 + meta: { title: '表单2', icon: 'form' }
53 } 60 }
54 ] 61 ]
55 }, 62 },
......