-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Terwer
committed
Feb 13, 2019
1 parent
99ce255
commit e0a0528
Showing
8 changed files
with
45 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
import Vue from "vue"; | ||
import App from "./App.vue"; | ||
new Vue({ | ||
el: "#app", | ||
render: h => h(App) | ||
}); | ||
|
||
/** | ||
* Expose a factory function that creates a fresh set of | ||
* app instances on each call (which is called for each SSR request) | ||
* @param ssrContext | ||
* @returns {{app: Vue | CombinedVueInstance<V, object, object, object, Record<never, any>>}} | ||
*/ | ||
export function createApp(ssrContext) { | ||
// create the app instance. | ||
const app = new Vue({ | ||
render: h => h(App) | ||
}); | ||
|
||
// expose the app | ||
// note we are not mounting the app here, since bootstrapping will be | ||
// different depending on whether we are in a browser or on the server. | ||
return { app }; | ||
// return { app, router, store } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { createApp } from "./app"; | ||
|
||
// noinspection JSCheckFunctionSignatures | ||
const { app } = createApp(); | ||
|
||
// actually mount to DOM | ||
app.$mount("#app"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { createApp } from "./app"; | ||
|
||
// This exported function will be called by `bundleRenderer`. | ||
// return a Promise that resolves to the app instance. | ||
export default context => { | ||
return new Promise((resolve, reject) => { | ||
const { app } = createApp(context); | ||
resolve(app); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { createApp } from "./app"; | ||
|
||
// noinspection JSCheckFunctionSignatures | ||
const { app } = createApp(); | ||
|
||
// actually mount to DOM | ||
app.$mount("#app"); |