Skip to content

Commit d90f633

Browse files
committed
update named routes example
1 parent 62cbcc0 commit d90f633

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/named-routes/app.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Vue.use(VueRouter)
55

66
const Home = { template: '<div>This is Home</div>' }
77
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>' }
99

1010
const router = new VueRouter({
1111
mode: 'history',
1212
base: __dirname,
1313
routes: [
1414
{ path: '/', name: 'home', component: Home },
1515
{ path: '/foo', name: 'foo', component: Foo },
16-
{ path: '/bar', name: 'bar', component: Bar }
16+
{ path: '/bar/:id', name: 'bar', component: Bar }
1717
]
1818
})
1919

@@ -26,7 +26,7 @@ new Vue({
2626
<ul>
2727
<li><router-link :to="{ name: 'home' }">home</router-link></li>
2828
<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>
3030
</ul>
3131
<router-view class="view"></router-view>
3232
</div>

test/e2e/specs/named-routes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
.click('li:nth-child(3) a')
2020
.assert.urlEquals('http://localhost:8080/named-routes/bar')
2121
.assert.containsText('p', 'Current route name: bar')
22-
.assert.containsText('.view', 'Bar')
22+
.assert.containsText('.view', 'Bar 123')
2323

2424
.click('li:nth-child(1) a')
2525
.assert.urlEquals('http://localhost:8080/named-routes/')

0 commit comments

Comments
 (0)