mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 18:19:40 +00:00
Add server-side rendering (via bundleRenderer, as this is what the Vue docs recommend, and apparently the only way it does encapsulation)
This commit is contained in:
16
templates/VueSpa/ClientApp/boot-server-bundle.ts
Normal file
16
templates/VueSpa/ClientApp/boot-server-bundle.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import Vue from 'vue';
|
||||
import VueRouter from 'vue-router';
|
||||
import { createServerRenderer, RenderResult } from 'aspnet-prerendering';
|
||||
import { createBundleRenderer } from 'vue-server-renderer';
|
||||
import { routes } from './routes';
|
||||
Vue.use(VueRouter);
|
||||
|
||||
export default function(context: any) {
|
||||
const router = new VueRouter({ mode: 'history', routes: routes })
|
||||
router.push(context.url);
|
||||
|
||||
return new Vue({
|
||||
render: h => h(require('./components/app/app.vue.html')),
|
||||
router: router
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user