File tree 9 files changed +160
-7
lines changed
9 files changed +160
-7
lines changed Original file line number Diff line number Diff line change 1
1
.DS_Store
2
2
node_modules
3
3
test /test.build.js
4
- test /test.html
4
+ test /test.html
5
+ example /example.build.js
6
+ TODOS.md
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module.exports = function (config) {
3
3
browsers : [ 'PhantomJS' ] ,
4
4
reporters : [ 'progress' ] ,
5
5
frameworks : [ 'jasmine' ] ,
6
- files : [ ' test/test.build.js'] ,
6
+ files : [ __dirname + '/../ test/test.build.js'] ,
7
7
singleRun : true
8
8
} )
9
9
}
Original file line number Diff line number Diff line change 1
1
var webpack = require ( "webpack" )
2
- var version = require ( './package.json' ) . version
2
+ var version = require ( '.. /package.json' ) . version
3
3
var banner =
4
4
'/**\n' +
5
5
' * vue-router v' + version + '\n' +
Original file line number Diff line number Diff line change
1
+ module . exports = {
2
+ entry : './example/example.js' ,
3
+ output : {
4
+ path : './example' ,
5
+ filename : 'example.build.js'
6
+ }
7
+ }
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ var Vue = require ( 'vue' )
2
+ var VueRouter = require ( '../src' )
3
+
4
+ Vue . use ( VueRouter )
5
+
6
+ var router = new VueRouter ( {
7
+ pushstate : true ,
8
+ root : '/hello'
9
+ } )
10
+
11
+ var root = new Vue ( {
12
+ el : '#app' ,
13
+ components : {
14
+ inbox : {
15
+ template : '<div><h2>inbox!</h2><div v-view></div></div>' ,
16
+ replace : true ,
17
+ components : {
18
+ message : {
19
+ template : '<div>message! {{route.params.messageId}}</div>' ,
20
+ replace : true
21
+ } ,
22
+ archive : {
23
+ template : '<div>archive lol</div>' ,
24
+ replace : true
25
+ }
26
+ }
27
+ } ,
28
+ user : {
29
+ template : '<h2>User yo</h2><div v-view></div>' ,
30
+ components : {
31
+ 'user-profile' : {
32
+ template : 'user profile {{route.params.userId}} {{route.params.something}}'
33
+ } ,
34
+ 'user-posts' : {
35
+ template : 'user posts'
36
+ } ,
37
+ 'user-settings' : {
38
+ template : 'user settings'
39
+ }
40
+ }
41
+ } ,
42
+ about : {
43
+ template : '<h1>OHHHH ABOUT</h1>' ,
44
+ replace : true
45
+ } ,
46
+ 'not-found' : {
47
+ template : 'FOUR OH FOUR'
48
+ }
49
+ }
50
+ } )
51
+
52
+ router . on ( '/inbox' , {
53
+ name : 'inbox' ,
54
+ component : 'inbox' ,
55
+ subRoutes : {
56
+ '/message/:messageId' : {
57
+ name : 'message' ,
58
+ component : 'message' ,
59
+ alwaysRefresh : true
60
+ } ,
61
+ '/archived' : {
62
+ name : 'archive' ,
63
+ component : 'archive'
64
+ }
65
+ }
66
+ } )
67
+
68
+ router . on ( '/user/:userId' , {
69
+ name : 'user' ,
70
+ component : 'user' ,
71
+ subRoutes : {
72
+ 'profile/:something' : {
73
+ component : 'user-profile'
74
+ } ,
75
+ 'posts' : {
76
+ component : 'user-posts'
77
+ } ,
78
+ 'settings' : {
79
+ component : 'user-settings'
80
+ }
81
+ }
82
+ } )
83
+
84
+ router . on ( '/about' , {
85
+ component : 'about' ,
86
+ } )
87
+
88
+ router . notfound ( {
89
+ component : 'not-found'
90
+ } )
91
+
92
+ router . redirect ( {
93
+ '/info' : '/about'
94
+ } )
95
+
96
+ router . start ( root )
Original file line number Diff line number Diff line change
1
+ < style >
2
+ .test {
3
+ transition : all .5s ease;
4
+ }
5
+ .test-enter , .test-leave {
6
+ opacity : 0 ;
7
+ }
8
+ </ style >
9
+
10
+ < div id ="app ">
11
+ < h1 > App Header</ h1 >
12
+ < a v-link ="/inbox/message/123 "> inbox</ a >
13
+ < a v-link ="/about "> about</ a >
14
+ < a v-link ="/user/1234 "> user</ a >
15
+ < div v-view class ="test " v-transition ="test " transition-mode ="out-in "> </ div >
16
+ </ div >
17
+
18
+ < script src ="example.build.js "> </ script >
Original file line number Diff line number Diff line change
1
+ var exec = require ( 'child_process' ) . exec
2
+ var spawn = require ( 'child_process' ) . spawn
3
+ var app = require ( 'express' ) ( )
4
+
5
+ app . get ( '/example.build.js' , function ( req , res ) {
6
+ res . sendFile ( __dirname + '/example.build.js' )
7
+ } )
8
+
9
+ app . get ( '*' , function ( req , res ) {
10
+ res . sendFile ( __dirname + '/index.html' )
11
+ } )
12
+
13
+ app . listen ( 3000 , function ( ) {
14
+ console . log ( 'dev server running on localhost:3000\n' )
15
+ openURL ( 'http://localhost:3000' )
16
+ } )
17
+
18
+ function openURL ( url ) {
19
+ switch ( process . platform ) {
20
+ case "darwin" :
21
+ exec ( 'open ' + url )
22
+ break
23
+ case "win32" :
24
+ exec ( 'start ' + url )
25
+ break
26
+ default :
27
+ spawn ( 'xdg-open' , [ url ] )
28
+ }
29
+ }
Original file line number Diff line number Diff line change 4
4
"description" : " A router for Vue.js" ,
5
5
"main" : " src/index.js" ,
6
6
"scripts" : {
7
- "dev" : " webpack --watch" ,
8
- "build" : " webpack" ,
9
- "test" : " webpack --config webpack.test.config.js && ./node_modules/karma/bin/karma start"
7
+ "dev" : " node example/serve.js & webpack --watch --config build/webpack.example.config.js " ,
8
+ "build" : " webpack --config build/webpack.build.config.js " ,
9
+ "test" : " webpack --config build/ webpack.test.config.js && ./node_modules/karma/bin/karma start build/karma.config.js "
10
10
},
11
11
"repository" : {
12
12
"type" : " git" ,
25
25
},
26
26
"homepage" : " https://github.com/vuejs/vue-router#readme" ,
27
27
"devDependencies" : {
28
+ "express" : " ^4.12.3" ,
28
29
"jasmine-core" : " ^2.3.2" ,
29
30
"karma" : " ^0.12.31" ,
30
31
"karma-jasmine" : " ^0.3.5" ,
31
32
"karma-phantomjs-launcher" : " ^0.1.4" ,
32
- "vue" : " ^0.11.10 " ,
33
+ "vue" : " yyx990803/vue#dev " ,
33
34
"webpack" : " ^1.8.11"
34
35
},
35
36
"dependencies" : {
You can’t perform that action at this time.
0 commit comments