@cc-component/cc-ex-component 1.9.5 → 1.9.7
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
CHANGED
|
@@ -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
|
|
372
|
+
if (this.isOnLoad) {
|
|
365
373
|
this[funcName]?.(value)
|
|
366
374
|
} else {
|
|
367
|
-
|
|
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]) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Vec2 } from 'cc';
|
|
1
2
|
import { _decorator, Component, Enum, Event, EventMouse, EventTouch, instantiate, Mask, math, Node, NodeEventType, NodePool, Prefab, ScrollView, UIOpacity, UITransform } from 'cc';
|
|
2
3
|
const { ccclass, property, executionOrder, disallowMultiple, help } = _decorator;
|
|
3
4
|
|
|
@@ -1432,7 +1433,13 @@ export class YXCollectionView extends Component {
|
|
|
1432
1433
|
private onScrollBegan() {
|
|
1433
1434
|
}
|
|
1434
1435
|
|
|
1435
|
-
private onScrolling() {
|
|
1436
|
+
private onScrolling(sv: ScrollView) {
|
|
1437
|
+
let maxOffset = sv.getMaxScrollOffset()
|
|
1438
|
+
let minOffset = Vec2.ZERO
|
|
1439
|
+
let curOffset = sv.getScrollOffset()
|
|
1440
|
+
if (math.Vec2.distance(maxOffset, curOffset) < 0.01 || math.Vec2.distance(minOffset, curOffset) < 0.01)
|
|
1441
|
+
sv.stopAutoScroll()
|
|
1442
|
+
|
|
1436
1443
|
// 在滚动过程中仅仅是标记更新状态,具体更新业务统一到 update 里面处理,但是 layout 设置了实时更新的情况时例外
|
|
1437
1444
|
if (this.layout.shouldUpdateAttributesForBoundsChange()) {
|
|
1438
1445
|
this.reloadVisibleElements()
|