From e4c0e646af147a8d3861f6e1ffe577ce9899babe Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 15 Mar 2024 18:18:22 +0800 Subject: [PATCH] =?UTF-8?q?chore(uts):=20=E5=90=8C=E6=AD=A5=20uts.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/platforms/app-plus/service/api/plugin/uts.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/platforms/app-plus/service/api/plugin/uts.js b/src/platforms/app-plus/service/api/plugin/uts.js index 498f410ed1..130c2cb281 100644 --- a/src/platforms/app-plus/service/api/plugin/uts.js +++ b/src/platforms/app-plus/service/api/plugin/uts.js @@ -7,7 +7,12 @@ const callbacks = {}; function isComponentPublicInstance(instance) { return instance && instance.$ && instance.$.proxy === instance; } +function toRaw(observed) { + const raw = observed && observed.__v_raw; + return raw ? toRaw(raw) : observed; +} function normalizeArg(arg) { + arg = toRaw(arg); if (typeof arg === 'function') { // 查找该函数是否已缓存 const oldId = Object.keys(callbacks).find((id) => callbacks[id] === arg); @@ -18,13 +23,15 @@ function normalizeArg(arg) { else if (isPlainObject(arg)) { if (isComponentPublicInstance(arg)) { let nodeId = ''; + let pageId = ''; // @ts-expect-error const el = arg.$el; // 非 x 可能不存在 getNodeId 方法? if (el && el.getNodeId) { + pageId = el.pageId; nodeId = el.getNodeId(); } - return { nodeId }; + return { pageId, nodeId }; } else { Object.keys(arg).forEach((name) => { -- GitLab