From 057e40f413c2ef93f6ec71dbb06c491d169c6c6f Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Wed, 22 Nov 2023 18:57:08 +0800 Subject: [PATCH] 表单只读控件,加深背景色 --- bases/Pilot.js | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bases/Pilot.js b/bases/Pilot.js index 7a849af..6dcacf0 100644 --- a/bases/Pilot.js +++ b/bases/Pilot.js @@ -21,10 +21,15 @@ methods: {}, }; const names = []; + let parent = null; // 实例本身的字段 Object.getOwnPropertyNames(this).forEach(name => names.push(name)); - // 类的字段 - Object.getOwnPropertyNames(Object.getPrototypeOf(this)).forEach(name => names.push(name)); + // 基类的字段,直到Pilot为止(不含Pilot) + parent = Object.getPrototypeOf(this); + while (parent instanceof Pilot) { + Object.getOwnPropertyNames(parent).forEach(name => names.push(name)); + parent = Object.getPrototypeOf(parent); + } // 传递 names.forEach(name => { // 构造器忽略,如果存在属性 $methods 也忽略 @@ -106,7 +111,7 @@ const nextPage = currentPages[pageIndex + 1]; if (nextPage) { clearInterval(timer); - nextPage.$component.$onMessage(action, nextData); + nextPage.$component?.$onMessage(action, nextData); } }, 50); } else if (pageType === 'prevPage') { @@ -114,12 +119,12 @@ const pageIndex = currentPages.findIndex(page => page.$component === $vm); const prevPage = currentPages[pageIndex - 1]; if (prevPage) { - prevPage.$component.$onMessage(action, nextData); + prevPage.$component?.$onMessage(action, nextData); } } else if (pageType === 'rootPage') { const currentPages = getCurrentPages(); const rootPage = currentPages[0]; - rootPage.$component.$onMessage(action, nextData); + rootPage.$component?.$onMessage(action, nextData); } }; } -- Gitblit v1.9.1