fix: Componnent will reset when select of drag

This commit is contained in:
2025-05-17 15:49:54 +08:00
parent 3fb59af2dd
commit c7907b4253
3 changed files with 18 additions and 13 deletions

View File

@@ -209,7 +209,7 @@ function updateDDSProperties(newProperties: any) {
}
// 存储当前选中组件的能力组件
const capabilityComponent = shallowRef(null);
const capabilityComponent = shallowRef<JSX.Element>();
// 获取组件实例上暴露的方法
async function getExposedCapabilities(componentType: string) {
@@ -275,12 +275,17 @@ watch(
if (newComponentData && newComponentData.type) {
try {
// 首先尝试从实例中获取暴露的方法
const capsComponent = await getExposedCapabilities(
newComponentData.type,
);
let capsComponent = null;
if (!isUndefined( newComponentData.capsPage ) && !isNull(newComponentData.capsPage)) {
capsComponent = newComponentData.capsPage;
capabilityComponent.value = markRaw(capsComponent);
}
else
capsComponent = await getExposedCapabilities(newComponentData.type);
if (capsComponent) {
capabilityComponent.value = markRaw(capsComponent);
newComponentData.capsPage = capsComponent;
console.log(`已从实例加载${newComponentData.type}组件的能力页面`);
return;
}