File tree Expand file tree Collapse file tree 4 files changed +19
-8
lines changed
Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 2525 "nprogress" : " ^0.2.0" ,
2626 "qrcode.vue" : " ^1.7.0" ,
2727 "tdesign-icons-vue" : " ^0.1.6" ,
28- "tdesign-vue" : " ^1.0.1 " ,
28+ "tdesign-vue" : " ^1.3.0 " ,
2929 "tvision-color" : " ~1.5.0" ,
3030 "typescript" : " ^4.2.4" ,
3131 "vue" : " ~2.6.14" ,
Original file line number Diff line number Diff line change 77</template >
88<script lang="ts">
99import { mapGetters } from ' vuex' ;
10+ import isBoolean from ' lodash/isBoolean' ;
11+ import isUndefined from ' lodash/isUndefined' ;
1012
1113export default {
1214 computed: {
@@ -16,7 +18,13 @@ export default {
1618 isUseTabsRouter: ' setting/isUseTabsRouter' ,
1719 }),
1820 aliveViews() {
19- return this .tabRouterList .filter ((route ) => route .isAlive ).map ((route ) => route .name );
21+ return this .tabRouterList
22+ .filter ((route ) => {
23+ const keepAliveConfig = route .meta ?.keepAlive ;
24+ const isRouteKeepAlive = isUndefined (keepAliveConfig ) || (isBoolean (keepAliveConfig ) && keepAliveConfig ); // 默认开启keepalive
25+ return route .isAlive && isRouteKeepAlive ;
26+ })
27+ .map ((route ) => route .name );
2028 },
2129 },
2230};
Original file line number Diff line number Diff line change 11<template >
22 <div >
3+ <t-back-top
4+ container =" .tdesign-starter-layout"
5+ :visible-height =" 0"
6+ style =" position : absolute "
7+ :offset =" ['24px', '80px']"
8+ >
9+ <t-icon name =" backtop" size =" 20px" />
10+ </t-back-top >
311 <!-- 顶部 card -->
412 <top-panel class =" row-container" />
513 <!-- 中部图表 -->
Original file line number Diff line number Diff line change @@ -27,10 +27,6 @@ const state: TTabRouterType = {
2727 isRefreshing : false ,
2828} ;
2929
30- // 不需要做多标签tabs页缓存的列表 值为每个页面对应的name 如 DashboardDetail
31- // const ignoreCacheRoutes = ['DashboardDetail'];
32- const ignoreCacheRoutes = [ ] ;
33-
3430const mutations = {
3531 // 处理刷新
3632 toggleTabRouterAlive ( state : TTabRouterType , routeIdx : number ) {
@@ -39,10 +35,9 @@ const mutations = {
3935 } ,
4036 // 处理新增
4137 appendTabRouterList ( state : TTabRouterType , newRoute : TRouterInfo ) {
42- const needAlive = ! ignoreCacheRoutes . includes ( newRoute . name ) ;
4338 if ( ! state . tabRouterList . find ( ( route : TRouterInfo ) => route . path === newRoute . path ) )
4439 // eslint-disable-next-line no-param-reassign
45- state . tabRouterList = state . tabRouterList . concat ( { ...newRoute , isAlive : needAlive } ) ;
40+ state . tabRouterList = state . tabRouterList . concat ( { ...newRoute , isAlive : true } ) ;
4641 } ,
4742 // 处理关闭当前
4843 subtractCurrentTabRouter ( state : TTabRouterType , newRoute : TRouterInfo ) {
You can’t perform that action at this time.
0 commit comments