@@ -29,14 +29,14 @@ import Vue from 'vue'
29
29
import App from ' ./App.vue'
30
30
import { createRouter } from ' ./router'
31
31
export function createApp () {
32
- // create router instance
32
+ // ルーターインスタンスを作成します
33
33
const router = createRouter ()
34
34
const app new Vue ({
35
- // inject router into root Vue instance
35
+ // ルーターをルートVueインスタンスに注入します
36
36
router,
37
37
render : h => h (App)
38
38
})
39
- // return both the app and the router
39
+ // アプリケーションとルーターの両方を返します
40
40
return { app, router }
41
41
}
42
42
```
@@ -47,21 +47,21 @@ export function createApp () {
47
47
// entry-server.js
48
48
import { createApp } from ' ./app'
49
49
export default context => {
50
- // since there could potentially be asynchronous route hooks or components,
51
- // we will be returning a Promise so that the server can wait until
52
- // everything is ready before rendering.
50
+ // 非同期のルートフックまたはコンポーネントが存在する可能性があるため、
51
+ // レンダリングする前にすべての準備が整うまでサーバーが待機できるように
52
+ // プロミスを返します。
53
53
return new Promise ((resolve , reject ) => {
54
54
const { app , router } = createApp ()
55
- // set server-side router's location
55
+ // サーバーサイドのルーターの場所を設定します
56
56
router .push (context .url )
57
- // wait until router has resolved possible async components and hooks
57
+ // ルーターが非同期コンポーネントとフックを解決するまで待機します
58
58
router .onReady (() => {
59
59
const matchedComponents = router .getMatchedComponents ()
60
- // no matched routes, reject with 404
60
+ // 一致するルートがない場合、404で拒否します
61
61
if (! matchedComponents .length ) {
62
62
reject ({ code: 404 })
63
63
}
64
- // the Promise should resolve to the app instance so it can be rendered
64
+ // プロミスはレンダリングできるようにアプリケーションインスタンスを解決するべきです
65
65
resolve (app)
66
66
}, reject)
67
67
})
@@ -98,9 +98,9 @@ server.get('*', (req, res) => {
98
98
Vue は非同期コンポーネントを最重要コンセプトとして提供しており、 [ webpack 2の動的インポートをコード分割点として使用することへのサポート] ( https://webpack.js.org/guides/code-splitting-async/ ) と組み合わせることも可能です。そのためにすべきことは以下です。
99
99
100
100
``` js
101
- // changing this ...
101
+ // これを ...
102
102
import Foo from ' ./Foo.vue'
103
- // to this:
103
+ // このように変えます。
104
104
const Foo = () => import (' ./Foo.vue' )
105
105
```
106
106
0 commit comments