-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_page.js
42 lines (38 loc) · 1.41 KB
/
app_page.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
export default function (siteconf, templateManager, componentManager) {
return function _createAppPageComponent (component, cfg, requiredTemplates) {
// tohle je ta hlavni aplikacni komponenta, ktera je obalovana touhle AppPAge
// v tomhle pripade ma jinde templates, takze to je funkce,
// ktera bere objekt s nactenyma templates (a ty je treba nacist)
async function _createAppComponent () {
const templates = {}
await Promise.all(requiredTemplates.map(name => {
return templateManager.get(name, cfg.templates).then(t => {
templates[name] = t
})
}))
return component(templates)
}
return async function () {
const template = await templateManager.get(cfg.layout)
const children = componentManager.prepareComponents(cfg.children || [])
const data = Object.assign({}, cfg, { children: _.union(children, [
Object.assign({}, cfg, {
component: requiredTemplates ? await _createAppComponent() : component
})
])})
return {
data: () => ({ data }),
metaInfo () {
return {
title: cfg.title,
meta: [
{ vmid: 'description', name: 'description', content: this.$data.data.desc },
{ vmid: 'keywords', name: 'keywords', content: this.$data.data.keywords }
]
}
},
template
}
}
}
}