fix(frontend): 菜单点击偶发无响应三处根因——①路由懒加载chunk失败被静默吞掉(新增onError自动整页重载+保险丝防循环) ②首页入口被权限接口阻塞(改乐观显示+缓存TTL10分钟+超时30s→8s) ③菜单hover预取目标页chunk(工具卡片/工作流步骤/顶部导航)
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<div class="nav-section-title">{{ group.label }}</div>
|
||||
<div class="nav-section-items">
|
||||
<template v-for="item in group.items" :key="item.key">
|
||||
<router-link v-if="item.href" :to="item.href" class="nav-item" :class="{ active: active === item.key }">
|
||||
<router-link v-if="item.href" :to="item.href" class="nav-item" :class="{ active: active === item.key }" @mouseenter="onNavItemHover(item.href)">
|
||||
{{ item.label }}
|
||||
</router-link>
|
||||
<span v-else class="nav-item disabled" :class="{ active: active === item.key }">
|
||||
@@ -36,7 +36,11 @@ import { computed, onMounted, ref } from 'vue'
|
||||
|
||||
import BrandApiSecretSettingsButton from '@/pages/brand/components/BrandApiSecretSettingsButton.vue'
|
||||
import { getCurrentUserAppColumnKeys } from '@/shared/api/permission'
|
||||
import { prefetchRouteChunk } from '@/shared/route-prefetch'
|
||||
import DownloadProgressPanel from '@/shared/components/DownloadProgressPanel.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
type ActiveNavKey =
|
||||
| 'brand'
|
||||
@@ -160,6 +164,11 @@ onMounted(async () => {
|
||||
allowedColumnKeys.value = []
|
||||
}
|
||||
})
|
||||
|
||||
/** 导航项 hover 预取目标页 chunk:弱网下点击跳转不再等 chunk 下载 */
|
||||
function onNavItemHover(href?: string) {
|
||||
prefetchRouteChunk(router, href)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user