@@ -29,14 +29,14 @@ import Vue from 'vue'
2929import App from ' ./App.vue'
3030import { createRouter } from ' ./router'
3131export function createApp () {
32- // create router instance
32+ // ルーターインスタンスを作成します
3333 const router = createRouter ()
3434 const app new Vue ({
35- // inject router into root Vue instance
35+ // ルーターをルートVueインスタンスに注入します
3636 router,
3737 render : h => h (App)
3838 })
39- // return both the app and the router
39+ // アプリケーションとルーターの両方を返します
4040 return { app, router }
4141}
4242```
@@ -47,21 +47,21 @@ export function createApp () {
4747// entry-server.js
4848import { createApp } from ' ./app'
4949export 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+ // プロミスを返します。
5353 return new Promise ((resolve , reject ) => {
5454 const { app , router } = createApp ()
55- // set server-side router's location
55+ // サーバーサイドのルーターの場所を設定します
5656 router .push (context .url )
57- // wait until router has resolved possible async components and hooks
57+ // ルーターが非同期コンポーネントとフックを解決するまで待機します
5858 router .onReady (() => {
5959 const matchedComponents = router .getMatchedComponents ()
60- // no matched routes, reject with 404
60+ // 一致するルートがない場合、404で拒否します
6161 if (! matchedComponents .length ) {
6262 reject ({ code: 404 })
6363 }
64- // the Promise should resolve to the app instance so it can be rendered
64+ // プロミスはレンダリングできるようにアプリケーションインスタンスを解決するべきです
6565 resolve (app)
6666 }, reject)
6767 })
@@ -98,9 +98,9 @@ server.get('*', (req, res) => {
9898Vue は非同期コンポーネントを最重要コンセプトとして提供しており、 [ webpack 2の動的インポートをコード分割点として使用することへのサポート] ( https://webpack.js.org/guides/code-splitting-async/ ) と組み合わせることも可能です。そのためにすべきことは以下です。
9999
100100``` js
101- // changing this ...
101+ // これを ...
102102import Foo from ' ./Foo.vue'
103- // to this:
103+ // このように変えます。
104104const Foo = () => import (' ./Foo.vue' )
105105```
106106
0 commit comments