fixed: 首次进入没有名称.

This commit is contained in:
lijiahang
2023-08-02 17:54:12 +08:00
parent 7915198be4
commit 598e33b0b5
9 changed files with 60 additions and 67 deletions

View File

@@ -1,6 +1,5 @@
import type { RouteLocationNormalized } from 'vue-router';
import { defineStore } from 'pinia';
import { DEFAULT_TAB, DEFAULT_ROUTE_NAME, routerToTag } from '@/router/constants';
import { DEFAULT_ROUTE_NAME, DEFAULT_TAB } from '@/router/constants';
import { isString } from '@/utils/is';
import { TabBarState, TagProps } from './types';
@@ -23,10 +22,10 @@ const useTabBarStore = defineStore('tabBar', {
/**
* 添加 tab
*/
updateTabList(route: RouteLocationNormalized) {
this.tagList.push(routerToTag(route));
if (!route.meta.ignoreCache) {
this.cacheTabList.add(route.name as string);
addTab(tag: TagProps, ignoreCache: boolean) {
this.tagList.push(tag);
if (!ignoreCache) {
this.cacheTabList.add(tag.name as string);
}
},