31 lines
641 B
JavaScript
31 lines
641 B
JavaScript
import { createSSRApp, h } from 'vue';
|
|
import { createPinia } from 'pinia';
|
|
import Container from './container.vue';
|
|
import { setPageContext } from './usePageContext';
|
|
|
|
import '../assets/css/style.css';
|
|
|
|
function createApp(pageContext) {
|
|
const PageWithLayout = {
|
|
render() {
|
|
return h(Container, {}, {
|
|
default() {
|
|
return h(pageContext.Page, pageContext.pageData || {});
|
|
},
|
|
});
|
|
},
|
|
};
|
|
|
|
const app = createSSRApp(PageWithLayout);
|
|
const store = createPinia();
|
|
|
|
app.use(store);
|
|
|
|
// We make pageContext available from any Vue component
|
|
setPageContext(app, pageContext);
|
|
|
|
return { app, store };
|
|
}
|
|
|
|
export { createApp };
|