Skip to content

Commit f5feea6

Browse files
committed
fix: 【商城装修】处理热区选择链接之后,当前链接被重置为undefined的问题
1 parent 2a06f67 commit f5feea6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/AppLinkInput/AppLinkSelectDialog.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ const activeAppLink = ref({} as AppLink)
8080
/** 打开弹窗 */
8181
const dialogVisible = ref(false)
8282
const open = (link: string) => {
83-
activeAppLink.value.path = link
83+
// 进入页面时先重置 activeAppLink
84+
activeAppLink.value = { name: '', path: '' }
8485
dialogVisible.value = true
8586
8687
// 滚动到当前的链接
@@ -102,8 +103,11 @@ defineExpose({ open })
102103
103104
// 处理 APP 链接选中
104105
const handleAppLinkSelected = (appLink: AppLink) => {
106+
// 只有不同链接时才更新(避免重复触发)
105107
if (!isSameLink(appLink.path, activeAppLink.value.path)) {
106-
activeAppLink.value = appLink
108+
// 如果新链接的 path 为空,则沿用当前 activeAppLink 的 path
109+
const path = appLink.path || activeAppLink.value.path
110+
activeAppLink.value = { ...appLink, path: path }
107111
}
108112
switch (appLink.type) {
109113
case APP_LINK_TYPE_ENUM.PRODUCT_CATEGORY_LIST:

0 commit comments

Comments
 (0)