@cc-component/cc-core 1.4.7 → 1.4.9
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.
|
@@ -333,8 +333,10 @@ export class App {
|
|
|
333
333
|
* param:参数
|
|
334
334
|
*/
|
|
335
335
|
const closeEvent: { eventName: string, param?: any } = view.closeEvent?.()
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
if (closeEvent) {
|
|
337
|
+
const close: Function = view[closeEvent.eventName]
|
|
338
|
+
if (close) { close.call(view, closeEvent.param) }
|
|
339
|
+
}
|
|
338
340
|
if (view && view.node && view.node.isValid) view.node.destroy(); // 关闭窗口
|
|
339
341
|
}
|
|
340
342
|
}
|
|
@@ -33,27 +33,35 @@ export class TabBarController extends Component {
|
|
|
33
33
|
|
|
34
34
|
@property(Prefab)
|
|
35
35
|
HomeTabbarItem: Prefab = null;
|
|
36
|
-
|
|
36
|
+
@property(Node)
|
|
37
|
+
bottom: Node = null;
|
|
37
38
|
|
|
38
39
|
layout: Layout;
|
|
39
40
|
itemList: Node[] = [];
|
|
40
41
|
public selectRow: number = 0;
|
|
41
42
|
|
|
43
|
+
isonload = false;
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
isReload = false;
|
|
45
46
|
onLoad() {
|
|
46
|
-
this.layout = this.getComponent(Layout);
|
|
47
|
-
|
|
47
|
+
this.layout = this.bottom.getComponent(Layout);
|
|
48
|
+
this.isonload = true
|
|
49
|
+
if (this.isReload) {
|
|
50
|
+
this.reload();
|
|
51
|
+
}
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
reload() {
|
|
55
|
+
this.isReload = true
|
|
56
|
+
if (this.isReload && !this.isonload) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
51
59
|
for (let index = 0; index < this.count; index++) {
|
|
52
60
|
let node = this.itemList[index]
|
|
53
61
|
if (!node) {
|
|
54
62
|
node = instantiate(this.HomeTabbarItem)
|
|
55
63
|
this.itemList.push(node);
|
|
56
|
-
node.parent = this.
|
|
64
|
+
node.parent = this.bottom;
|
|
57
65
|
}
|
|
58
66
|
node.name = index.toString();
|
|
59
67
|
node.active = true;
|
|
@@ -72,6 +80,7 @@ export class TabBarController extends Component {
|
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
switchTab(index: number, isDefault: boolean = false) {
|
|
83
|
+
if (!this.isonload) return
|
|
75
84
|
if (this.selectRow === index && !isDefault) { return }
|
|
76
85
|
this.callbackSelect?.(index, this.itemList[index], this.itemList[this.selectRow])
|
|
77
86
|
this.selectRow = index;
|