@cloudbase/lowcode-builder 1.1.4 → 1.1.5
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/mp/util.js
CHANGED
|
@@ -67,7 +67,7 @@ function generateDataBindMeta(bind) {
|
|
|
67
67
|
imports += (0, lowcode_generator_1.generateExpressionAlias)(value);
|
|
68
68
|
}
|
|
69
69
|
catch (e) {
|
|
70
|
-
console.error('parse expression error', value, e);
|
|
70
|
+
console.error('parse expression error', value, e === null || e === void 0 ? void 0 : e.message);
|
|
71
71
|
}
|
|
72
72
|
expr = value;
|
|
73
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
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",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@cloudbase/cals": "^0.4.10",
|
|
42
|
-
"@cloudbase/lowcode-generator": "^1.1.
|
|
42
|
+
"@cloudbase/lowcode-generator": "^1.1.2",
|
|
43
43
|
"axios": "^0.21.0",
|
|
44
44
|
"browserfs": "^1.4.3",
|
|
45
45
|
"browserify-zlib": "^0.2.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
import { findForItemsOfWidget, getWidget } from './widget'
|
|
3
|
-
import { observable } from 'mobx';
|
|
3
|
+
import { observable, untracked } from 'mobx';
|
|
4
4
|
import { getAccessToken } from '../datasources/index'
|
|
5
5
|
import { app } from '../app/weapps-api'
|
|
6
6
|
|
|
@@ -31,9 +31,13 @@ export function createComputed(funcs, bindContext = null) {
|
|
|
31
31
|
export function generateDataContext(widget) {
|
|
32
32
|
const dataContext = {};
|
|
33
33
|
while (widget?._scope) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const current = widget
|
|
35
|
+
// 此处采用代理的方式,是为了可以获取到最新的 _scope.dataContext 防止 dataContext 引用被重新赋值
|
|
36
|
+
Object.defineProperty(dataContext, current._scope.id, {
|
|
37
|
+
get() {
|
|
38
|
+
return current._scope.dataContext;
|
|
39
|
+
},
|
|
40
|
+
});
|
|
37
41
|
widget = widget.parent;
|
|
38
42
|
}
|
|
39
43
|
return dataContext;
|
|
@@ -57,7 +61,7 @@ export function createEventHandlers(evtListeners) {
|
|
|
57
61
|
const [prefix = ''] = name.split('$');
|
|
58
62
|
// The page event handler
|
|
59
63
|
const { lists = [], itemsById = {} } = !!currentTarget && findForItemsOfWidget(currentTarget) || {}
|
|
60
|
-
const dataContext = generateDataContext(currentTarget)
|
|
64
|
+
const dataContext = untracked(()=>generateDataContext(currentTarget))
|
|
61
65
|
|
|
62
66
|
listeners.forEach(async l => {
|
|
63
67
|
let { data = {}, boundData = {} } = l;
|
|
@@ -221,7 +221,7 @@ function runFor(
|
|
|
221
221
|
clearTimeout(_FOR_ERROR_CACHE_MAP[nodeId]);
|
|
222
222
|
|
|
223
223
|
const $instance = ownerMpInst.getWeAppInst();
|
|
224
|
-
const dataContext = generateDataContext(defaultParent);
|
|
224
|
+
const dataContext = untracked(()=>generateDataContext(defaultParent));
|
|
225
225
|
|
|
226
226
|
forList = dataBinds[nodeId]._waFor.call(
|
|
227
227
|
$instance,
|
|
@@ -364,7 +364,7 @@ function setUpWidgetDataBinds(w, dataBinds, forItems, failedBinds, ctx) {
|
|
|
364
364
|
try {
|
|
365
365
|
clearTimeout(timer);
|
|
366
366
|
|
|
367
|
-
const dataContext = generateDataContext(w);
|
|
367
|
+
const dataContext = untracked(()=>generateDataContext(w));
|
|
368
368
|
|
|
369
369
|
// Computed data bind in the next tick since data bind may read widgets data
|
|
370
370
|
const value = dataBinds[prop].call(ctx, ctx, forItems.lists, forItems.itemsById, undefined, dataContext);
|