mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-11-10 14:57:09 +08:00
feat: 优化 GiForm(同步 GiDemo 更新)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user