From a171489dbc6ff0c8efe2f909e23333b1de824ef8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 28 Oct 2025 21:03:18 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=E3=80=91diy=20editor?= =?UTF-8?q?=20=E7=9A=84=20hot-zone=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8870%=EF=BC=89=E4=BD=BF=E7=94=A8=20Modal=20=E6=9B=BF?= =?UTF-8?q?=E4=BB=A3=20el-dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app-link-input/select-dialog.vue | 65 +++++++++---------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue b/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue index 7962dc165..818f8764b 100644 --- a/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue +++ b/apps/web-ele/src/views/mall/promotion/components/app-link-input/select-dialog.vue @@ -5,9 +5,10 @@ import type { AppLink } from './data'; import { nextTick, ref } from 'vue'; +import { useVbenModal } from '@vben/common-ui'; import { getUrlNumberValue } from '@vben/utils'; -import { ElScrollbar } from 'element-plus'; +import { ElButton, ElScrollbar, ElTooltip } from 'element-plus'; import ProductCategorySelect from '#/views/mall/product/category/components/product-category-select.vue'; @@ -39,12 +40,20 @@ const detailSelectDialog = ref<{ type: undefined, }); // 详情选择对话框 -const dialogVisible = ref(false); +const [Modal, modalApi] = useVbenModal({ + onConfirm() { + emit('change', activeAppLink.value.path); + emit('appLinkChange', activeAppLink.value); + modalApi.close(); + }, +}); + +defineExpose({ open }); /** 打开弹窗 */ -function open(link: string) { +async function open(link: string) { activeAppLink.value.path = link; - dialogVisible.value = true; + modalApi.open(); // 滚动到当前的链接 const group = APP_LINK_GROUP_LIST.find((group) => group.links.some((linkItem) => { @@ -56,14 +65,12 @@ function open(link: string) { }), ); if (group) { - // TODO @AI:await 方式; // 使用 nextTick 的原因:可能 Dom 还没生成,导致滚动失败 - nextTick(() => handleGroupSelected(group.name)); + await nextTick(); + handleGroupSelected(group.name); } } -defineExpose({ open }); - /** 处理 APP 链接选中 */ function handleAppLinkSelected(appLink: AppLink) { if (!isSameLink(appLink.path, activeAppLink.value.path)) { @@ -87,12 +94,6 @@ function handleAppLinkSelected(appLink: AppLink) { } } -function handleSubmit() { - dialogVisible.value = false; - emit('change', activeAppLink.value.path); - emit('appLinkChange', activeAppLink.value); -} - /** * 处理右侧链接列表滚动 * @@ -156,15 +157,17 @@ function handleProductCategorySelected(id: number) { } -