Commit 642a520d authored by 李维's avatar 李维

保护一些空变量

parent 912fb60f
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {
"android": "default",
"ios": "default"
},
"optimizeHotUpdate": {
"android": false,
"ios": false
},
"inlineSpriteFrames": {
"android": false,
"ios": false
},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
{"ver":"1.1.2","uuid":"c35bb2f6-f24a-4850-ae44-643f2fdc7541","isBundle":false,"bundleName":"","priority":1,"compressionType":{"android":"default","ios":"default"},"optimizeHotUpdate":{"android":false,"ios":false},"inlineSpriteFrames":{"android":false,"ios":false},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
\ No newline at end of file
......@@ -54,7 +54,7 @@ export default class UnitPageClass extends PageComponentBaseClass {
// 页面即将显示
async beforeMount() {
this.isDestory = false;
this.isDestroy = false;
}
// 页面显示
......@@ -66,14 +66,14 @@ export default class UnitPageClass extends PageComponentBaseClass {
}
// 页面隐藏
isDestory = false;
isDestroy = false;
async unmounted() {
const content = this.svContent;
const sv = this.unitScrollView.getComponent(cc.ScrollView);
this.unitScrollView.off("scrolling");
sv.scrollToTop();
content.destroyAllChildren();
this.isDestory = true;
this.isDestroy = true;
this.lastUpdate = 0;
this.allListItemNodes.forEach(node => {
node && node.destroy()
......@@ -229,7 +229,7 @@ export default class UnitPageClass extends PageComponentBaseClass {
// 刷新右上角“课程简介”按钮显示隐藏
refreshConfig() {
if (this.configData && this.configData.introduces.length > 0) {
if (this.configData && this.configData.introduces && this.configData.introduces.length > 0) {
this.btn_preview.active = true
} else {
this.btn_preview.active = false
......@@ -250,7 +250,7 @@ export default class UnitPageClass extends PageComponentBaseClass {
for (let i = 0; i < dataArr.length; i++) {
// 此方法为异步方法,防止页面切换走以后仍然执行,在这里判断一下是否页面已经切换走
if(this.isDestory) {
if(this.isDestroy) {
break
}
const data = dataArr[i];
......@@ -360,7 +360,7 @@ export default class UnitPageClass extends PageComponentBaseClass {
lastUpdate = 0;
update (dt) {
if(this.isDestory) {
if(this.isDestroy && !this.allListItemNodes) {
return
}
if(this.lastUpdate < this.allListItemNodes.length) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment