Merge pull request #8868 from 2betop/fix-jssdk-scope

fix: 修复 jssdk 模式通过 embed 返回的 scoped 获取组件失败的问题 Close: #8864
This commit is contained in:
hsm-lv 2023-11-23 17:37:18 +08:00 committed by GitHub
commit ce3b325457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -259,7 +259,13 @@ export function embed(
...props,
scopeRef: (ref: any) => {
if (ref) {
Object.assign(scoped, ref);
Object.keys(ref).forEach(key => {
let value = ref[key];
if (typeof value === 'function') {
value = value.bind(ref);
}
(scoped as any)[key] = value;
});
callback?.();
}
}