File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,15 @@ Vue.use(VueRouter)
5
5
6
6
const Home = { template : '<div>This is Home</div>' }
7
7
const Foo = { template : '<div>This is Foo</div>' }
8
- const Bar = { template : '<div>This is Bar</div>' }
8
+ const Bar = { template : '<div>This is Bar {{ $route.params.id }} </div>' }
9
9
10
10
const router = new VueRouter ( {
11
11
mode : 'history' ,
12
12
base : __dirname ,
13
13
routes : [
14
14
{ path : '/' , name : 'home' , component : Home } ,
15
15
{ path : '/foo' , name : 'foo' , component : Foo } ,
16
- { path : '/bar' , name : 'bar' , component : Bar }
16
+ { path : '/bar/:id ' , name : 'bar' , component : Bar }
17
17
]
18
18
} )
19
19
@@ -26,7 +26,7 @@ new Vue({
26
26
<ul>
27
27
<li><router-link :to="{ name: 'home' }">home</router-link></li>
28
28
<li><router-link :to="{ name: 'foo' }">foo</router-link></li>
29
- <li><router-link :to="{ name: 'bar' }">bar</router-link></li>
29
+ <li><router-link :to="{ name: 'bar', params: { id: 123 } }">bar</router-link></li>
30
30
</ul>
31
31
<router-view class="view"></router-view>
32
32
</div>
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module.exports = {
19
19
. click ( 'li:nth-child(3) a' )
20
20
. assert . urlEquals ( 'http://localhost:8080/named-routes/bar' )
21
21
. assert . containsText ( 'p' , 'Current route name: bar' )
22
- . assert . containsText ( '.view' , 'Bar' )
22
+ . assert . containsText ( '.view' , 'Bar 123 ' )
23
23
24
24
. click ( 'li:nth-child(1) a' )
25
25
. assert . urlEquals ( 'http://localhost:8080/named-routes/' )
You can’t perform that action at this time.
0 commit comments