From fce4567ded5d02eeced9a8d69650ab1a154397c2 Mon Sep 17 00:00:00 2001 From: baofuchun <2730439190@qq.com> Date: Sun, 29 Sep 2024 17:38:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AD=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=9C=A8=E7=88=B6=E7=BB=84=E4=BB=B6setup=E6=97=B6?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96$scope=E5=AD=97=E6=AE=B5=20?= =?UTF-8?q?ask=20199111?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: 修复子组件在父组件setup时无法获取$scope字段 ask 199111 --- packages/runtime-core/src/component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index 2ad0a66f188..c922e863ddf 100644 --- a/packages/runtime-core/src/component.ts +++ b/packages/runtime-core/src/component.ts @@ -1115,10 +1115,13 @@ export function getExposeProxy(instance: ComponentInternalInstance) { return target[key] } else if (key in publicPropertiesMap) { return publicPropertiesMap[key](instance) + } else if (key === '$scope') { + // TODO 临时补充$scope 字段,后续通过publicPropertiesMap 字段补充。ask:199111 + return instance.ctx.$scope } }, has(target, key: string) { - return key in target || key in publicPropertiesMap + return key in target || key in publicPropertiesMap || key === '$scope' }, })) )