mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-12-23 13:16:49 +08:00
parent
5ed7b4ead5
commit
db3561aa88
|
@ -168,7 +168,7 @@ export default defineComponent({
|
||||||
|
|
||||||
const renderContent = () => {
|
const renderContent = () => {
|
||||||
const { showBreadcrumb, showFooter, isUseTabsRouter } = settingStore;
|
const { showBreadcrumb, showFooter, isUseTabsRouter } = settingStore;
|
||||||
const { tabRouters } = tabsRouterStore;
|
const tabRouters = tabsRouterStore.tabRouters.filter((route) => route.isAlive || route.isHome);
|
||||||
return (
|
return (
|
||||||
// <t-layout class={[`${prefix}-layout`]} key={route.name}> 如果存在多个滚动列表之间切换时,页面不刷新导致的样式问题 请设置key 但会导致多标签tab页的缓存失效
|
// <t-layout class={[`${prefix}-layout`]} key={route.name}> 如果存在多个滚动列表之间切换时,页面不刷新导致的样式问题 请设置key 但会导致多标签tab页的缓存失效
|
||||||
<t-layout class={[`${prefix}-layout`]}>
|
<t-layout class={[`${prefix}-layout`]}>
|
||||||
|
|
|
@ -19,7 +19,7 @@ const state = {
|
||||||
|
|
||||||
// 不需要做多标签tabs页缓存的列表 值为每个页面对应的name 如 DashboardDetail
|
// 不需要做多标签tabs页缓存的列表 值为每个页面对应的name 如 DashboardDetail
|
||||||
// const ignoreCacheRoutes = ['DashboardDetail'];
|
// const ignoreCacheRoutes = ['DashboardDetail'];
|
||||||
const ignoreCacheRoutes = [];
|
const ignoreCacheRoutes = ['login'];
|
||||||
|
|
||||||
export const useTabsRouterStore = defineStore('tabsRouter', {
|
export const useTabsRouterStore = defineStore('tabsRouter', {
|
||||||
state: () => state,
|
state: () => state,
|
||||||
|
@ -35,7 +35,7 @@ export const useTabsRouterStore = defineStore('tabsRouter', {
|
||||||
},
|
},
|
||||||
// 处理新增
|
// 处理新增
|
||||||
appendTabRouterList(newRoute: TRouterInfo) {
|
appendTabRouterList(newRoute: TRouterInfo) {
|
||||||
const needAlive = !ignoreCacheRoutes.includes(newRoute.name);
|
const needAlive = !ignoreCacheRoutes.includes(newRoute.name as string);
|
||||||
if (!this.tabRouters.find((route: TRouterInfo) => route.path === newRoute.path)) {
|
if (!this.tabRouters.find((route: TRouterInfo) => route.path === newRoute.path)) {
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
this.tabRouterList = this.tabRouterList.concat({ ...newRoute, isAlive: needAlive });
|
this.tabRouterList = this.tabRouterList.concat({ ...newRoute, isAlive: needAlive });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user