From 4f84a331522797d86508ba5f3d14dd9aead1ac26 Mon Sep 17 00:00:00 2001 From: xyf-mac Date: Sun, 7 Nov 2021 12:14:50 +0800 Subject: [PATCH] bugfix --- source/src/devtools/ui/ui-prop.vue | 4 ---- source/src/inject/index.ts | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source/src/devtools/ui/ui-prop.vue b/source/src/devtools/ui/ui-prop.vue index 3652145..4c44847 100644 --- a/source/src/devtools/ui/ui-prop.vue +++ b/source/src/devtools/ui/ui-prop.vue @@ -224,10 +224,6 @@ export default class UiProp extends Vue { mounted() { this.watchValue(); - if(this.isInvalid()){ - this.value.data; - debugger - } } isShowTooltip() { diff --git a/source/src/inject/index.ts b/source/src/inject/index.ts index 73bce7f..6bb7a5b 100644 --- a/source/src/inject/index.ts +++ b/source/src/inject/index.ts @@ -258,6 +258,7 @@ class CCInspector { const data: ImageData = options.data; const path: Array = options.path; if (ctor && value instanceof ctor) { + // 2.4.6 没有了这个属性 if (value.hasOwnProperty("_textureFilename")) { data.path = path; //@ts-ignore @@ -327,13 +328,16 @@ class CCInspector { })) if (!info) { if (typeof propertyValue === "object") { - let ctorName = propertyValue.constructor.name; - if (ctorName.startsWith("cc_")) { - info = new EngineData(); - info.engineType = ctorName; - info.engineName = propertyValue.name; - info.engineUUID = propertyValue.uuid; + let ctorName = propertyValue.constructor?.name; + if (ctorName) { + if (ctorName.startsWith("cc_")) { + info = new EngineData(); + info.engineType = ctorName; + info.engineName = propertyValue.name; + info.engineUUID = propertyValue.uuid; + } } else { + // 空{} info = this._buildObjectData({ data: new ObjectData(), path: path, @@ -393,7 +397,7 @@ class CCInspector { _isInvalidValue(value: any) { // !!Infinity=true - if ((value && value !== Infinity) || value === 0 || value === false) { + if ((value && value !== Infinity) || value === 0 || value === false || value === "") { return false; } @@ -577,7 +581,7 @@ class CCInspector { let target = this.inspectorGameMemoryStorage; for (let i = 0; i < path.length; i++) { let key = path[i]; - if (target.hasOwnProperty(key)) { + if (target[key] !== undefined || target.hasOwnProperty(key)) { target = target[key] } else { return null;