@monkeyplus/flow 6.0.4 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/lib/render.mjs +13 -12
package/package.json
CHANGED
package/server/lib/render.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import UApp from "@nuxt/ui/components/App.vue";
|
|
2
|
-
import { createHead } from "@unhead/vue/server";
|
|
2
|
+
import { createHead, transformHtmlTemplate } from "@unhead/vue/server";
|
|
3
3
|
import { renderToString } from "@vue/server-renderer";
|
|
4
|
-
import { transformHtmlTemplate } from "unhead/server";
|
|
5
4
|
import bases from "virtual:flow/bases";
|
|
6
5
|
import layouts from "virtual:flow/layouts";
|
|
7
6
|
import templates from "virtual:flow/templates";
|
|
@@ -96,18 +95,19 @@ async function renderBody(page) {
|
|
|
96
95
|
head: head2
|
|
97
96
|
};
|
|
98
97
|
}
|
|
98
|
+
const context = {
|
|
99
|
+
page: page.definition,
|
|
100
|
+
context: page.context,
|
|
101
|
+
head: page.head,
|
|
102
|
+
seo: page.seo,
|
|
103
|
+
locale: page.locale,
|
|
104
|
+
params: page.params,
|
|
105
|
+
path: page.pathname
|
|
106
|
+
};
|
|
99
107
|
const TemplateRoot = defineComponent({
|
|
100
108
|
render() {
|
|
101
|
-
const viewNode = h(TemplateComponent,
|
|
102
|
-
|
|
103
|
-
context: page.context,
|
|
104
|
-
head: page.head,
|
|
105
|
-
seo: page.seo,
|
|
106
|
-
locale: page.locale,
|
|
107
|
-
params: page.params,
|
|
108
|
-
path: page.pathname
|
|
109
|
-
});
|
|
110
|
-
const content = LayoutComponent ? h(LayoutComponent, {}, {
|
|
109
|
+
const viewNode = h(TemplateComponent, context);
|
|
110
|
+
const content = LayoutComponent ? h(LayoutComponent, context, {
|
|
111
111
|
default: () => viewNode
|
|
112
112
|
}) : viewNode;
|
|
113
113
|
return h(UApp, {}, {
|
|
@@ -116,6 +116,7 @@ async function renderBody(page) {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
const app = createSSRApp(TemplateRoot);
|
|
119
|
+
app.provide("context", context);
|
|
119
120
|
const head = createHead();
|
|
120
121
|
head.push(normalizeSeoToHead(page.head, fallbackTitle, fallbackDescription));
|
|
121
122
|
app.use(head);
|