@cc-component/cc-ex-component 2.0.9 → 2.1.1
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/assets/core/ViewModel.ts +3 -3
- package/package.json +1 -1
package/assets/core/ViewModel.ts
CHANGED
|
@@ -324,7 +324,7 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
|
|
|
324
324
|
//绑定的方法
|
|
325
325
|
const funcName = bindingMapFunc.get(self.className)?.get(key)
|
|
326
326
|
if (funcName) {
|
|
327
|
-
const result = self[funcName]?.(value); // 调用函数获取返回值
|
|
327
|
+
const result = self[funcName]?.(value, false); // 调用函数获取返回值
|
|
328
328
|
// ✅ 关键:如果返回值不是 undefined,则返回计算值
|
|
329
329
|
if (result !== undefined) {
|
|
330
330
|
return result;
|
|
@@ -466,7 +466,7 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
|
|
|
466
466
|
private refreshData(key: string, value: any) {
|
|
467
467
|
const funcName = bindingMapFunc.get(this.className)?.get(key)
|
|
468
468
|
if (this.isOnLoad) {
|
|
469
|
-
this[funcName]?.(value)
|
|
469
|
+
this[funcName]?.(value, true)
|
|
470
470
|
} else {
|
|
471
471
|
this.funcMap.set(funcName, value)
|
|
472
472
|
}
|
|
@@ -475,7 +475,7 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
|
|
|
475
475
|
private refreshFuncName() {
|
|
476
476
|
// console.error('刷新数据失败:', this.funcMap)
|
|
477
477
|
this.funcMap.forEach((value, key) => {
|
|
478
|
-
this[key]?.(value)
|
|
478
|
+
this[key]?.(value, true)//true:是set方法,否则是get方法
|
|
479
479
|
})
|
|
480
480
|
}
|
|
481
481
|
|