@cloudbase/lowcode-builder 1.8.49 → 1.8.50
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/lib/builder/core/index.d.ts +4 -1
- package/lib/builder/core/index.js +2 -1
- package/lib/builder/h5/generate.d.ts +3 -1
- package/lib/builder/h5/generate.js +5 -1
- package/lib/builder/h5/index.js +1 -0
- package/lib/builder/h5/webpack.d.ts +3 -1
- package/lib/builder/h5/webpack.js +2 -1
- package/lib/builder/mp/BuildContext.d.ts +4 -0
- package/lib/builder/mp/index.js +7 -0
- package/lib/builder/mp/util.d.ts +1 -0
- package/lib/builder/mp/util.js +2 -1
- package/package.json +2 -2
- package/template/html/index.html.ejs +2 -1
- package/template/mp/common/weapp-page.js +34 -11
- package/template/mp/page/index.js +5 -2
|
@@ -41,6 +41,9 @@ export interface IBuildWedaApp extends IBaseAppProps {
|
|
|
41
41
|
isPrivateMode?: boolean;
|
|
42
42
|
endpointType?: 'tcb-api' | 'wechat-service';
|
|
43
43
|
enableExpiredTag?: boolean;
|
|
44
|
+
account?: {
|
|
45
|
+
uin?: string;
|
|
46
|
+
};
|
|
44
47
|
}
|
|
45
48
|
export declare function buildWedaConfig({ output, domain, isPrivateMode, endpointType, buildTypeList, }: {
|
|
46
49
|
output: Required<IBuildWedaApp['output']>;
|
|
@@ -49,7 +52,7 @@ export declare function buildWedaConfig({ output, domain, isPrivateMode, endpoin
|
|
|
49
52
|
endpointType?: IBuildWedaApp['endpointType'];
|
|
50
53
|
buildTypeList?: IBuildWedaApp['buildTypeList'];
|
|
51
54
|
}): Promise<void>;
|
|
52
|
-
export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
|
|
55
|
+
export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, account, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
|
|
53
56
|
export declare function cleanComponentDir(): Promise<void>;
|
|
54
57
|
export declare const version: any;
|
|
55
58
|
export { getFiles, fileToZip, strToBuf } from '../util/generateFiles';
|
|
@@ -60,7 +60,7 @@ exports.buildWedaConfig = buildWedaConfig;
|
|
|
60
60
|
async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appKey = 'test', runtime = types_1.RUNTIME.NONE, ignoreInstall = false, buildTypeList = [common_1.BuildType.WEB], mode = common_1.WebpackModeType.PRODUCTION, devTool = 'webpack', deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW }, generateMpType = common_1.GenerateMpType.APP, plugins = [], extraData = {
|
|
61
61
|
isComposite: false,
|
|
62
62
|
compProps: {},
|
|
63
|
-
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, }, cb) {
|
|
63
|
+
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, account = {}, }, cb) {
|
|
64
64
|
var _a, _b, _c, _d, _e;
|
|
65
65
|
if (!cals) {
|
|
66
66
|
console.error('无效的应用配置');
|
|
@@ -80,6 +80,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
80
80
|
});
|
|
81
81
|
let appBuildDir = (output === null || output === void 0 ? void 0 : output.path) || (runtime === types_1.RUNTIME.CI ? (_a = (0, util_1.getCompileDirs)('app')) === null || _a === void 0 ? void 0 : _a.appBuildDir : (_b = (0, util_1.getCompileDirs)(appKey)) === null || _b === void 0 ? void 0 : _b.appBuildDir);
|
|
82
82
|
const buildContext = {
|
|
83
|
+
uin: account === null || account === void 0 ? void 0 : account.uin,
|
|
83
84
|
projDir: appBuildDir,
|
|
84
85
|
appId: appKey,
|
|
85
86
|
isProduction: mode === common_1.WebpackModeType.PRODUCTION,
|
|
@@ -2,16 +2,18 @@ import { BuildAppProps } from '@cloudbase/lowcode-generator';
|
|
|
2
2
|
import { IPlatformApp } from '@cloudbase/cals';
|
|
3
3
|
import { ICDN_ENDPOINTS_COFIG } from '../config';
|
|
4
4
|
import { BuildType } from '../types/common';
|
|
5
|
+
import { IBuildContext } from '../mp/BuildContext';
|
|
5
6
|
/**
|
|
6
7
|
* 该函数从 @govcloud/generate 取到需要的模版文件
|
|
7
8
|
*/
|
|
8
9
|
export declare function generateProjectFiles(buildData: BuildAppProps): Promise<void>;
|
|
9
|
-
export declare function generateHTML({ appId, envId, description, appBuildDir, externalResources, mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
|
10
|
+
export declare function generateHTML({ buildContext, appId, envId, description, appBuildDir, externalResources, mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
|
10
11
|
/**
|
|
11
12
|
* 由于存量兜底逻辑存在
|
|
12
13
|
* 默认值为 undefined 否则应为 false
|
|
13
14
|
*/
|
|
14
15
|
enableLoading, }: {
|
|
16
|
+
buildContext: Omit<IBuildContext, 'mainAppData'>;
|
|
15
17
|
appId: string;
|
|
16
18
|
envId: string;
|
|
17
19
|
description?: string;
|
|
@@ -15,6 +15,7 @@ const config_1 = require("../config");
|
|
|
15
15
|
const lodash_1 = require("lodash");
|
|
16
16
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
17
|
const common_2 = require("../types/common");
|
|
18
|
+
const index_1 = require("../core/index");
|
|
18
19
|
/**
|
|
19
20
|
* 该函数从 @govcloud/generate 取到需要的模版文件
|
|
20
21
|
*/
|
|
@@ -25,12 +26,14 @@ async function generateProjectFiles(buildData) {
|
|
|
25
26
|
}));
|
|
26
27
|
}
|
|
27
28
|
exports.generateProjectFiles = generateProjectFiles;
|
|
28
|
-
async function generateHTML({ appId, envId, description = '', appBuildDir, externalResources = [], mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
|
29
|
+
async function generateHTML({ buildContext, appId, envId, description = '', appBuildDir, externalResources = [], mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
|
29
30
|
/**
|
|
30
31
|
* 由于存量兜底逻辑存在
|
|
31
32
|
* 默认值为 undefined 否则应为 false
|
|
32
33
|
*/
|
|
33
34
|
enableLoading = undefined, }) {
|
|
35
|
+
const { materialLibs, uin } = buildContext;
|
|
36
|
+
const officialLib = materialLibs.find((item) => item.name === cals_1.OFFICIAL_LIB_KEY);
|
|
34
37
|
const templatePath = path_1.default.join(config_1.appTemplateDir, 'html', 'index.html.ejs');
|
|
35
38
|
const dstFilePath = path_1.default.join(appBuildDir, 'index.html');
|
|
36
39
|
const packageTpl = await fs_extra_1.default.readFile(templatePath, { encoding: 'utf8' });
|
|
@@ -59,6 +62,7 @@ enableLoading = undefined, }) {
|
|
|
59
62
|
isBuildApp,
|
|
60
63
|
isAdminPortal: (0, common_2.buildAsAdminPortalByBuildType)(buildTypeList),
|
|
61
64
|
cdnEndpoints: (0, config_1.generateCdnEndpoints)(cdnEndpoints),
|
|
65
|
+
ext3: [envId, uin, index_1.version, officialLib === null || officialLib === void 0 ? void 0 : officialLib.version, '' /* mpappId */].join('|'),
|
|
62
66
|
/**
|
|
63
67
|
* @deprecated
|
|
64
68
|
* 此次临时保留白名单兜底逻辑
|
package/lib/builder/h5/index.js
CHANGED
|
@@ -139,6 +139,7 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
|
|
|
139
139
|
await (0, generate_1.generateThemeVarsFile)(mainAppData.themeVars, h5BuildDir);
|
|
140
140
|
// 生成 webpack 配置
|
|
141
141
|
const webpackConfigPath = await (0, webpack_1.runWebpackCore)({
|
|
142
|
+
buildContext,
|
|
142
143
|
cals,
|
|
143
144
|
appKey,
|
|
144
145
|
mainAppData,
|
|
@@ -2,7 +2,9 @@ import { IWebRuntimeAppData } from '@cloudbase/lowcode-generator/lib/weapps-core
|
|
|
2
2
|
import { BuildAppProps } from '../core/index';
|
|
3
3
|
import { IPlatformApp } from '@cloudbase/cals';
|
|
4
4
|
import { ICDN_ENDPOINTS_COFIG } from '../config';
|
|
5
|
+
import { IBuildContext } from '../mp/BuildContext';
|
|
5
6
|
interface IWebpackCoreProps extends BuildAppProps {
|
|
7
|
+
buildContext: Omit<IBuildContext, 'mainAppData'>;
|
|
6
8
|
cals: IPlatformApp;
|
|
7
9
|
appBuildDir: string;
|
|
8
10
|
mainAppData: IWebRuntimeAppData;
|
|
@@ -10,5 +12,5 @@ interface IWebpackCoreProps extends BuildAppProps {
|
|
|
10
12
|
assets: string[];
|
|
11
13
|
cdnEndpoints?: ICDN_ENDPOINTS_COFIG;
|
|
12
14
|
}
|
|
13
|
-
export declare function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode, appKey, buildTypeList, assets, devTool, generateMpType, cdnEndpoints, }: IWebpackCoreProps): Promise<string>;
|
|
15
|
+
export declare function runWebpackCore({ buildContext, cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode, appKey, buildTypeList, assets, devTool, generateMpType, cdnEndpoints, }: IWebpackCoreProps): Promise<string>;
|
|
14
16
|
export {};
|
|
@@ -5,7 +5,7 @@ const common_1 = require("../types/common");
|
|
|
5
5
|
const webpack_1 = require("../service/webpack");
|
|
6
6
|
const generate_1 = require("./generate");
|
|
7
7
|
const cals_1 = require("@cloudbase/cals");
|
|
8
|
-
async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode = common_1.WebpackModeType.NONE, appKey, buildTypeList = [common_1.BuildType.WEB], assets = [], devTool = 'vite', generateMpType = common_1.GenerateMpType.APP, cdnEndpoints, }) {
|
|
8
|
+
async function runWebpackCore({ buildContext, cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode = common_1.WebpackModeType.NONE, appKey, buildTypeList = [common_1.BuildType.WEB], assets = [], devTool = 'vite', generateMpType = common_1.GenerateMpType.APP, cdnEndpoints, }) {
|
|
9
9
|
var _a;
|
|
10
10
|
console.time('runWebpackCore');
|
|
11
11
|
console.time('webpackGenerate');
|
|
@@ -21,6 +21,7 @@ async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir,
|
|
|
21
21
|
});
|
|
22
22
|
console.timeEnd('webpackGenerate');
|
|
23
23
|
await (0, generate_1.generateHTML)({
|
|
24
|
+
buildContext,
|
|
24
25
|
appId: mainAppData.id || appKey,
|
|
25
26
|
envId: mainAppData.envId || '',
|
|
26
27
|
description: cals.description || cals.label || '',
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -349,6 +349,12 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
|
349
349
|
const importor = (0, util_3.generateLowcodeImportor)(page.lowCodes);
|
|
350
350
|
const pageFileName = (0, lodash_1.get)(pageConfigs, `${page.id}.pageFileName`, 'index');
|
|
351
351
|
const subLevelPath = rootPath ? `${path_1.default.posix.relative(`packages/${rootPath}`, '')}/` : '';
|
|
352
|
+
const pageDataBinds = {};
|
|
353
|
+
Object.entries(page.data || {}).forEach(([prop, val]) => {
|
|
354
|
+
if (prop === null || prop === void 0 ? void 0 : prop.startsWith('appShareMessage')) {
|
|
355
|
+
(0, util_2.setDataBind)(pageDataBinds, prop, val);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
352
358
|
const pageFileData = {
|
|
353
359
|
[`api.js|api.js`]: {
|
|
354
360
|
subLevelPath,
|
|
@@ -368,6 +374,7 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
|
368
374
|
pageAttributes: {
|
|
369
375
|
...(((_e = page.data) === null || _e === void 0 ? void 0 : _e.appShareMessage) ? { appShareMessage: page.data.appShareMessage.value } : {}),
|
|
370
376
|
},
|
|
377
|
+
pageDataBinds,
|
|
371
378
|
debug: ctx.debugMode,
|
|
372
379
|
stringifyObj: util_1.inspect,
|
|
373
380
|
subLevelPath,
|
package/lib/builder/mp/util.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare function createTemplateEventFlows(ctx: IBuildContext, eventFlows?
|
|
|
26
26
|
export declare function createDataBinds(ctx: IBuildContext, widgets: {
|
|
27
27
|
[key: string]: IWeAppComponentInstance;
|
|
28
28
|
}): {};
|
|
29
|
+
export declare function setDataBind(target: any, prop: string, val: IDynamicValue): void;
|
|
29
30
|
export declare function processRepeaterSchema(ctx: any, componentInstanceMap: {
|
|
30
31
|
[key: string]: IWeAppComponentInstance;
|
|
31
32
|
}): {
|
package/lib/builder/mp/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findComponentInfo = exports.processRepeaterSchema = exports.createDataBinds = exports.createTemplateEventFlows = exports.createTemplateQuery = exports.generateDataContainerListeners = exports.generateSyncListeners = exports.createEventHandlers = exports.createWidgetProps = exports.generatedDynamicData = void 0;
|
|
3
|
+
exports.findComponentInfo = exports.processRepeaterSchema = exports.setDataBind = exports.createDataBinds = exports.createTemplateEventFlows = exports.createTemplateQuery = exports.generateDataContainerListeners = exports.generateSyncListeners = exports.createEventHandlers = exports.createWidgetProps = exports.generatedDynamicData = void 0;
|
|
4
4
|
const weapps_core_1 = require("@cloudbase/lowcode-generator/lib/weapps-core");
|
|
5
5
|
const lowcode_generator_1 = require("@cloudbase/lowcode-generator");
|
|
6
6
|
const weapp_1 = require("@cloudbase/lowcode-generator/lib/generator/util/weapp");
|
|
@@ -390,6 +390,7 @@ function setDataBind(target, prop, val) {
|
|
|
390
390
|
// }
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
+
exports.setDataBind = setDataBind;
|
|
393
394
|
function processRepeaterSchema(ctx, componentInstanceMap) {
|
|
394
395
|
(0, weapp_1.walkThroughWidgets)(componentInstanceMap, (id, component, parentId) => {
|
|
395
396
|
var _a, _b;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.50",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/core": "7.21.4",
|
|
44
44
|
"@babel/preset-env": "7.21.4",
|
|
45
|
-
"@cloudbase/cals": "^1.0.
|
|
45
|
+
"@cloudbase/cals": "^1.0.37",
|
|
46
46
|
"@cloudbase/lowcode-generator": "^1.8.14",
|
|
47
47
|
"axios": "^0.21.0",
|
|
48
48
|
"browserfs": "^1.4.3",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
reportAssetSpeed: true, // 静态资源测速
|
|
30
30
|
spa: true,
|
|
31
31
|
ext1: '<%=appId%>',
|
|
32
|
+
ext3: '<%=ext3%>',
|
|
32
33
|
version: '<%= !isAdminPortal? "0.0.2" : "0.0.3" %>',
|
|
33
34
|
});
|
|
34
35
|
window._aegis = _aegis;
|
|
@@ -540,7 +541,7 @@
|
|
|
540
541
|
crossorigin
|
|
541
542
|
src="<%=
|
|
542
543
|
cdnEndpoints.cdngo
|
|
543
|
-
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.
|
|
544
|
+
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.0c7ed7985795b51590f8.bundle.js"
|
|
544
545
|
></script>
|
|
545
546
|
</body>
|
|
546
547
|
</html>
|
|
@@ -21,10 +21,13 @@ import { runWatchers } from './watch';
|
|
|
21
21
|
import { $w as baseAPI } from '../app/weapps-api';
|
|
22
22
|
import { Event } from './event-emitter';
|
|
23
23
|
import { generatePageUrl } from '@cloudbase/weda-client';
|
|
24
|
+
import { mergeDynamic2StaticData } from './util';
|
|
25
|
+
|
|
26
|
+
export const PAGE_ROOT_SYMBOL = Symbol('@@page_route@@')
|
|
24
27
|
|
|
25
28
|
const wxApp = getApp();
|
|
26
29
|
|
|
27
|
-
function extractLifecycles(ctx, lifecycle, appShareMessage, resetShare = true) {
|
|
30
|
+
function extractLifecycles(ctx, lifecycle, appShareMessage, dataBinds, resetShare = true) {
|
|
28
31
|
const result = {};
|
|
29
32
|
Object.keys(lifecycle).map((name) => {
|
|
30
33
|
result[name] = function () {
|
|
@@ -37,13 +40,32 @@ function extractLifecycles(ctx, lifecycle, appShareMessage, resetShare = true) {
|
|
|
37
40
|
if (res?.from === 'button' && res?.target?.dataset?.weda_share_info) {
|
|
38
41
|
return res?.target?.dataset?.weda_share_info;
|
|
39
42
|
} else if (res?.from === 'menu' && appShareMessage?.enable) {
|
|
40
|
-
let
|
|
43
|
+
let mergedData = { appShareMessage }
|
|
44
|
+
try {
|
|
45
|
+
mergedData = mergeDynamic2StaticData({ appShareMessage }, dataBinds, {
|
|
46
|
+
codeContext: {
|
|
47
|
+
/**
|
|
48
|
+
* $page 或 $comp 实例
|
|
49
|
+
*/
|
|
50
|
+
instance: ctx.app?.__internal__?.activePage,
|
|
51
|
+
},
|
|
52
|
+
$w: ctx.app?.__internal__?.activePage?.__internal__?.$w,
|
|
53
|
+
})
|
|
54
|
+
} catch(e) {
|
|
55
|
+
console.warn('分享设置绑定计算错误:', e)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let { pageId, params, imageUrl, title, packageName } = mergedData.appShareMessage || {};
|
|
59
|
+
const url = generatePageUrl({
|
|
60
|
+
pageId,
|
|
61
|
+
packageName,
|
|
62
|
+
params: Array.isArray(params) ? params.reduce((map, { key, value }) => {
|
|
63
|
+
map[key] = value
|
|
64
|
+
return map
|
|
65
|
+
}, {}) : params,
|
|
66
|
+
})
|
|
41
67
|
return {
|
|
42
|
-
path:
|
|
43
|
-
pageId,
|
|
44
|
-
packageName,
|
|
45
|
-
params,
|
|
46
|
-
}),
|
|
68
|
+
path: url,
|
|
47
69
|
imageUrl: ctx.app?.__internal__?.resolveStaticResourceUrl?.(imageUrl) || imageUrl,
|
|
48
70
|
title,
|
|
49
71
|
};
|
|
@@ -84,7 +106,7 @@ export function createPage({
|
|
|
84
106
|
state,
|
|
85
107
|
computed,
|
|
86
108
|
evtListeners,
|
|
87
|
-
dataBinds,
|
|
109
|
+
dataBinds = {},
|
|
88
110
|
handlers,
|
|
89
111
|
query: datasetQuery = {},
|
|
90
112
|
eventFlows = [],
|
|
@@ -93,11 +115,12 @@ export function createPage({
|
|
|
93
115
|
resetShare = true,
|
|
94
116
|
}) {
|
|
95
117
|
const evtHandlers = createEventHandlers(evtListeners);
|
|
118
|
+
const {[PAGE_ROOT_SYMBOL]: pageRootDataBinds, ...componentDataBinds} = dataBinds
|
|
96
119
|
|
|
97
120
|
return Component({
|
|
98
121
|
_componentType: 'page',
|
|
99
122
|
data: {
|
|
100
|
-
...createInitData(widgetProps,
|
|
123
|
+
...createInitData(widgetProps, componentDataBinds),
|
|
101
124
|
_isCheckingAtuh: false,
|
|
102
125
|
_expiredMessage: '',
|
|
103
126
|
weDaHasLogin: null,
|
|
@@ -166,7 +189,7 @@ export function createPage({
|
|
|
166
189
|
_disposers: [],
|
|
167
190
|
|
|
168
191
|
/** page lifecycles **/
|
|
169
|
-
...extractLifecycles({ app }, lifecycle, pageAttributes?.appShareMessage, resetShare),
|
|
192
|
+
...extractLifecycles({ app }, lifecycle, pageAttributes?.appShareMessage, pageRootDataBinds, resetShare),
|
|
170
193
|
...evtHandlers,
|
|
171
194
|
...mergeRenderer,
|
|
172
195
|
async beforePageCustomLaunch(query) {
|
|
@@ -333,7 +356,7 @@ export function createPage({
|
|
|
333
356
|
});
|
|
334
357
|
}
|
|
335
358
|
|
|
336
|
-
const { widgets, rootWidget } = createWidgets(widgetProps,
|
|
359
|
+
const { widgets, rootWidget } = createWidgets(widgetProps, componentDataBinds, this, $page.widgets);
|
|
337
360
|
$page.widgets = widgets;
|
|
338
361
|
$page._rootWidget = rootWidget;
|
|
339
362
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { observable } from 'mobx';
|
|
2
|
-
import { createPage } from '<%= subLevelPath %>../../common/weapp-page'
|
|
2
|
+
import { createPage, PAGE_ROOT_SYMBOL } from '<%= subLevelPath %>../../common/weapp-page'
|
|
3
3
|
import { concatClassList, px2rpx } from '<%= subLevelPath %>../../common/style'
|
|
4
4
|
import { app, $app } from '<%= subLevelPath %>../../app/weapps-api'
|
|
5
5
|
import { <%= pageNameVar %> as handlers } from '../../app/handlers'
|
|
@@ -53,7 +53,10 @@ import { widgetProps } from './data'
|
|
|
53
53
|
/** widget event listeners **/
|
|
54
54
|
const evtListeners = {<% printEventHandler(eventHandlers) %>}
|
|
55
55
|
|
|
56
|
-
const dataBinds = {
|
|
56
|
+
const dataBinds = {
|
|
57
|
+
[PAGE_ROOT_SYMBOL]: {
|
|
58
|
+
<%= printBoundData(pageDataBinds) %>
|
|
59
|
+
},<% Object.entries(dataBinds).map(([id, widgetBinds])=>{%>
|
|
57
60
|
<%= id %>: { <%= printBoundData(widgetBinds) %>
|
|
58
61
|
},<%}) %>
|
|
59
62
|
}
|