feat: 优化 GiForm(同步 GiDemo 更新)

This commit is contained in:
2025-02-27 22:44:04 +08:00
parent 15ae164eef
commit 47769f9ad8
32 changed files with 589 additions and 586 deletions

View File

@@ -9,7 +9,7 @@ const storeSetup = () => {
const tabList = ref<RouteLocationNormalized[]>([]) // 保存页签tab的数组
const cacheList = ref<RouteRecordName[]>([]) // keep-alive缓存的数组元素是组件名
// 添加一个页签, 如果当前路由已经打开, 则不再重复添加
// 添加一个页签如果当前路由已经打开则不再重复添加
const addTabItem = (item: RouteLocationNormalized) => {
const index = tabList.value.findIndex((i) => i.path === item.path)
if (index >= 0) {
@@ -45,6 +45,17 @@ const storeSetup = () => {
tabList.value = arr
}
// 设置当前tab页签名称
const setTabTitle = (title: string) => {
if (!title) return false
const route = router.currentRoute.value
const path = route?.fullPath || route.path
const index = tabList.value.findIndex((i) => i.fullPath === path)
if (index >= 0) {
tabList.value[index].meta.title = title
}
}
// 添加缓存页
const addCacheItem = (item: RouteLocationNormalized) => {
if (!item.name) return
@@ -142,6 +153,7 @@ const storeSetup = () => {
addTabItem,
deleteTabItem,
clearTabList,
setTabTitle,
addCacheItem,
deleteCacheItem,
clearCacheList,