@cc-component/cc-ex-component 1.9.5 → 1.9.6

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.
@@ -124,7 +124,7 @@ export function BindViewModel<T extends new () => any>(constructor: T) {
124
124
 
125
125
  this.onLoadFinish();
126
126
  onLoad.call(this);
127
-
127
+ this.onLoadFinished();
128
128
  };
129
129
  };
130
130
 
@@ -241,6 +241,8 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
241
241
  /**是否记录-不记录可重复打开窗口 */
242
242
  is_record?: boolean;
243
243
  };
244
+ isOnLoad: boolean = false
245
+ funcMap: Map<string, any> = new Map()
244
246
  // 创建响应式数据
245
247
  _makeReactive<T extends object>(obj: T, pathPrefix: string): T {
246
248
  const self = this as any;
@@ -332,6 +334,7 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
332
334
 
333
335
  protected onLoad(): void {
334
336
  super.onLoad()
337
+ this.isOnLoad = true;
335
338
  this.bindFunc()
336
339
  this.onTouch()
337
340
  this.managerData()
@@ -343,6 +346,11 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
343
346
  }
344
347
 
345
348
 
349
+
350
+ onLoadFinished() {
351
+ this.refreshFuncName()
352
+ }
353
+
346
354
  managerData() {
347
355
  ExComponentModule.EmitUIWindow(this.config, this.viewModel)
348
356
  }
@@ -361,13 +369,17 @@ export function ViewModel<T extends new (...args: any[]) => Component>(Base: T)
361
369
 
362
370
  private refreshData(key: string, value: any) {
363
371
  const funcName = bindingMapFunc.get(this.className)?.get(key)
364
- if (this[funcName]) {
372
+ if (this.isOnLoad) {
365
373
  this[funcName]?.(value)
366
374
  } else {
367
- //console.error('没有找到方法:', funcName, this.node.name)
375
+ this.funcMap.set(funcName, value)
368
376
  }
369
377
  }
370
378
 
379
+ private refreshFuncName() {
380
+ this.funcMap.forEach((value, key) => { this[key]?.(value) })
381
+ }
382
+
371
383
  resetButtonScale(btn: Button) {
372
384
  if (btn.transition === Button.Transition.SCALE && ExComponentModule.EmitAnim()) {
373
385
  if (btn[this.touch_start_scale]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-ex-component",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",