fix:【ele】【mall】修复 diy-editor 拖拽后,无法切回“index”首页的问题

This commit is contained in:
YunaiV
2025-11-02 19:59:30 +08:00
parent b4ed04f695
commit dd86598833
2 changed files with 7 additions and 2 deletions

View File

@@ -79,7 +79,7 @@ const handleCloneComponent = (component: DiyComponent<any>) => {
:group="{ name: 'component', pull: 'clone', put: false }" :group="{ name: 'component', pull: 'clone', put: false }"
:clone="handleCloneComponent" :clone="handleCloneComponent"
:animation="200" :animation="200"
:force-fallback="true" :force-fallback="false"
> >
<template #item="{ element }"> <template #item="{ element }">
<div> <div>

View File

@@ -112,6 +112,11 @@ watch(
if (!val || selectedComponentIndex.value === -1) { if (!val || selectedComponentIndex.value === -1) {
return; return;
} }
// 如果是基础设置页,默认选中的索引改成 -1为了防止删除组件后切换到此页导致报错
// https://gitee.com/yudaocode/yudao-ui-admin-vue3/pulls/792
if (props.showTabBar) {
selectedComponentIndex.value = -1;
}
pageComponents.value[selectedComponentIndex.value] = pageComponents.value[selectedComponentIndex.value] =
selectedComponent.value!; selectedComponent.value!;
}, },
@@ -382,7 +387,7 @@ onMounted(() => {
<draggable <draggable
v-model="pageComponents" v-model="pageComponents"
:animation="200" :animation="200"
:force-fallback="true" :force-fallback="false"
class="page-prop-area drag-area" class="page-prop-area drag-area"
filter=".component-toolbar" filter=".component-toolbar"
ghost-class="draggable-ghost" ghost-class="draggable-ghost"