@cloudbase/lowcode-builder 1.4.2 → 1.4.3

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.
@@ -94,16 +94,18 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
94
94
  // 尽早下载物料
95
95
  await (0, net_1.downloadBrowserMaterial)(output === null || output === void 0 ? void 0 : output.path);
96
96
  }
97
+ const { enablePageRoot } = (0, cals_1.parseVersion)(cals === null || cals === void 0 ? void 0 : cals.schemaVersion, dependencies);
97
98
  const mpBuildContext = {
98
99
  ...buildContext,
99
100
  projDir: (output === null || output === void 0 ? void 0 : output.path) || path_1.default.join(appBuildDir, 'mp'),
100
101
  mainAppData: mainAppSerializeData,
101
102
  processCssUnit: ([cals, ...subAppCalsList].find((cals) => {
102
- const FEATURE_MAP = (0, cals_1.parseVersion)(cals.schemaVersion);
103
+ const FEATURE_MAP = (0, cals_1.parseVersion)(cals.schemaVersion, dependencies);
103
104
  return !FEATURE_MAP.defaultDynamicCssUnit;
104
105
  })
105
106
  ? 'px'
106
107
  : 'rpx'),
108
+ enablePageRoot,
107
109
  };
108
110
  const result = await (0, index_1.generateWxMp)({
109
111
  weapps: apps,
@@ -26,4 +26,9 @@ export interface IBuildContext {
26
26
  * 云开发sdk请求,js-sdk or wx.cloud
27
27
  */
28
28
  endpointType?: 'tcb-api' | 'wechat-service';
29
+ /**
30
+ * 是否在页面层面添加节点
31
+ * 并设置 #page-root-id
32
+ */
33
+ enablePageRoot?: boolean;
29
34
  }
@@ -32,13 +32,15 @@ function generateWxml(ctx, widgets, docTag, wxmlDataPrefix, usingComponents, com
32
32
  ].concat(createXml(widgets)),
33
33
  };
34
34
  if (ctx.isPage) {
35
+ const { enablePageRoot } = ctx;
35
36
  const originElements = xmlJson.elements;
36
37
  // 登录校验: 向其最外层包裹一层block
37
38
  xmlJson.elements = [
38
39
  {
39
40
  type: 'element',
40
- name: 'block',
41
+ name: enablePageRoot ? 'view' : 'block',
41
42
  attributes: {
43
+ id: 'wd-page-root',
42
44
  ['wx:if']: '{{weDaHasLogin}}',
43
45
  ['data-weui-theme']: 'light',
44
46
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
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",
@@ -453,7 +453,7 @@
453
453
  crossorigin="anonymous"
454
454
  src="<%=
455
455
  cdnEndpoints.cdngo
456
- %>/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.19/dist/h5.browser.js"
456
+ %>/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.27-alpha.0/dist/h5.browser.js"
457
457
  ></script>
458
458
  <script>
459
459
  // zxing polifill
@@ -475,7 +475,7 @@
475
475
  crossorigin
476
476
  src="<%=
477
477
  cdnEndpoints.cdngo
478
- %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.efbaa5f34f9a013bf4b1.bundle.js"
478
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.2d3f3e4f3bfd356a2a85.bundle.js"
479
479
  ></script>
480
480
  </body>
481
481
  </html>
@@ -790,12 +790,13 @@ class UserWidget {
790
790
  }
791
791
 
792
792
  get custom() {
793
- const instance = this._widget._getInstanceRef?.()?.current || {};
793
+ const widget = this._widget;
794
+ const instance = widget._getInstanceRef?.()?.current || {};
794
795
  const userCustomMember = untracked(() => {
795
796
  const { methods = {}, ...restInstance } = instance;
796
797
  return new Proxy(
797
798
  {
798
- ...this._widget._methods,
799
+ ...widget._methods,
799
800
  ...restInstance,
800
801
  ...methods,
801
802
  },
@@ -807,7 +808,7 @@ class UserWidget {
807
808
  if (prop !== 'methods' && prop in instance) {
808
809
  return instance[prop];
809
810
  }
810
- return this._widget._methods?.[prop];
811
+ return widget?._methods?.[prop];
811
812
  },
812
813
  },
813
814
  );