@cc-component/cc-ex-component 2.0.4 → 2.0.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.
@@ -296,6 +296,7 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
296
296
  const self = this as any;
297
297
  return new Proxy(obj, {
298
298
  get(target, key: string) {
299
+
299
300
  // ✅ 跳过 $ 开头的属性:直接返回原始值,不代理
300
301
  if (key.startsWith(skip)) {
301
302
  return target[key];
@@ -306,6 +307,12 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
306
307
  // console.log(`get ${pathPrefix}----${key}`);
307
308
  // return self._makeReactive(value, `${pathPrefix}.${key}`);
308
309
  // }
310
+
311
+ //绑定的方法
312
+ const funcName = bindingMapFunc.get(self.className)?.get(key)
313
+ if (funcName) {
314
+ return self[funcName]?.()
315
+ }
309
316
  return value;
310
317
  },
311
318
  set(target, key: string, value: any) {
@@ -433,7 +440,10 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
433
440
  }
434
441
 
435
442
  private refreshFuncName() {
436
- this.funcMap.forEach((value, key) => { this[key]?.(value) })
443
+ // console.error('刷新数据失败:', this.funcMap)
444
+ this.funcMap.forEach((value, key) => {
445
+ this[key]?.(value)
446
+ })
437
447
  }
438
448
 
439
449
  resetButtonScale(btn: Button) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-ex-component",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",