Skip to content

Commit ed30899

Browse files
committed
warn string id usage
1 parent a80f16c commit ed30899

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Diff for: docs/en/essentials/getting-started.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ const Bar = { template: '<div>bar</div>' }
4040
// 2. Define some routes
4141
// Each route should map to a component. The "component" can
4242
// either be an actual component constructor created via
43-
// Vue.extend(), a component id string registered via Vue.component(),
44-
// or just a component options object.
43+
// Vue.extend(), or just a component options object.
4544
// We'll talk about nested routes later.
4645
const routes = [
4746
{ path: '/foo', component: Foo },

Diff for: docs/ja/essentials/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const Bar = { template: '<div>bar</div>' }
3939

4040
// 2. ルートをいくつか定義します
4141
// 各ルートは 1 つのコンポーネントとマッピングされる必要があります。
42-
// このコンポーネントは実際の Vue.extend()、Vue.component() 経由によってコンポーネント ID が登録された文字列、
42+
// このコンポーネントは実際の Vue.extend()、
4343
// またはコンポーネントオプションのオブジェクトでも構いません。
4444
// ネストされたルートに関しては後で説明します
4545
const routes = [

Diff for: src/create-route-map.js

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ function addRouteRecord (
2929
) {
3030
const { path, name } = route
3131
assert(path != null, `"path" is required in a route configuration.`)
32+
assert(
33+
typeof route.component !== 'string',
34+
`route config "component" for path: ${String(path || name)} cannot be a ` +
35+
`string id. Use an actual component instead.`
36+
)
3237

3338
const record: RouteRecord = {
3439
path: normalizePath(path, parent),

0 commit comments

Comments
 (0)