This repository was archived by the owner on Nov 1, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +141
-9
lines changed
Expand file tree Collapse file tree 6 files changed +141
-9
lines changed Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" defalut-layout" >
3+ <h1 >vue-template</h1 >
4+ <router-view />
5+ </div >
6+ </template >
7+
8+ <script >
9+ export default {
10+ name: ' defalut-layout' ,
11+ data () {
12+ return {}
13+ }
14+ }
15+ </script >
16+
17+ <style lang="scss" scoped>
18+ .defalut-layout {
19+ text-align : center ;
20+ }
21+ </style >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" about" >
3+ <h2 >about</h2 >
4+ </div >
5+ </template >
6+
7+ <script >
8+ export default {
9+ name: ' about' ,
10+ data () {
11+ return {}
12+ }
13+ }
14+ </script >
15+
16+ <style lang="scss" scoped>
17+ </style >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" err-404" >
3+ <p >404</p >
4+ </div >
5+ </template >
6+
7+ <script >
8+ export default {
9+ name: ' err-404' ,
10+ data () {
11+ return {
12+ }
13+ }
14+ }
15+ </script >
16+
17+ <style scoped>
18+ </style >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" err-500" >
3+ <p >500</p >
4+ </div >
5+ </template >
6+
7+ <script >
8+ export default {
9+ name: ' err-500' ,
10+ data () {
11+ return {
12+ }
13+ }
14+ }
15+ </script >
16+
17+ <style scoped>
18+ </style >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" home" >
3+ <h2 >{{ msg }}</h2 >
4+ </div >
5+ </template >
6+
7+ <script >
8+ export default {
9+ name: ' home' ,
10+ data () {
11+ return {
12+ msg: ' Welcome to Your Vue.js App'
13+ }
14+ }
15+ }
16+ </script >
17+
18+ <style lang="scss" scoped>
19+ </style >
Original file line number Diff line number Diff line change 11import Vue from 'vue'
22import Router from 'vue-router'
3- import HelloWorld from '@/components/HelloWorld'
3+
4+ import defaultLayout from '@/layouts/defaultLayout'
5+
6+ import Home from '@/pages/Home'
7+ import About from '@/pages/About'
8+ import Err404 from '@/pages/Err404'
9+ import Err500 from '@/pages/Err500'
410
511Vue . use ( Router )
612
7- export default new Router ( {
8- routes : [
9- {
10- path : '/' ,
11- name : 'HelloWorld' ,
12- component : HelloWorld
13- }
14- ]
13+ export const constantRouter = [
14+ {
15+ path : '/' ,
16+ component : defaultLayout ,
17+ redirect : 'home' ,
18+ children : [
19+ {
20+ path : 'home' ,
21+ component : Home ,
22+ name : 'home'
23+ } ,
24+ {
25+ path : 'about' ,
26+ component : About ,
27+ name : 'about'
28+ }
29+ ]
30+ } ,
31+ {
32+ path : '*' ,
33+ component : defaultLayout ,
34+ redirect : 'err404' ,
35+ children : [
36+ {
37+ path : 'err404' ,
38+ component : Err404 ,
39+ name : 'err404'
40+ } ,
41+ {
42+ path : 'err500' ,
43+ component : Err500 ,
44+ name : 'err500'
45+ }
46+ ]
47+ }
48+ ]
49+
50+ const router = new Router ( {
51+ routes : constantRouter
1552} )
53+
54+ export default router
You can’t perform that action at this time.
0 commit comments