'admin-22.05.29:优化最新版是否开启TagsView缓存的设置有严重Bug[#I59RXK](https://gitee.com/lyt-top/vue-next-admin/issues/I59RXK)'

This commit is contained in:
lyt 2022-05-29 16:10:57 +08:00
parent 6441700ae1
commit 21248a361e

View File

@ -11,7 +11,7 @@
</template>
<script lang="ts">
import { computed, defineComponent, toRefs, reactive, getCurrentInstance, onBeforeMount, onUnmounted, nextTick, watch } from 'vue';
import { computed, defineComponent, toRefs, reactive, getCurrentInstance, onBeforeMount, onUnmounted, nextTick, watch, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { storeToRefs } from 'pinia';
import { useKeepALiveNames } from '/@/stores/keepAliveNames';
@ -47,8 +47,6 @@ export default defineComponent({
});
//
onBeforeMount(() => {
// https://gitee.com/lyt-top/vue-next-admin/issues/I58U75
if (themeConfig.value.isCacheTagsView) cachedViews.value = Session.get('tagsViewList').map((item: any) => item.name);
state.keepAliveNameList = keepAliveNames.value;
proxy.mittBus.on('onTagsViewRefreshRouterView', (fullPath: string) => {
state.keepAliveNameList = keepAliveNames.value.filter((name: string) => route.name !== name);
@ -59,6 +57,16 @@ export default defineComponent({
});
});
});
//
onMounted(() => {
// https://gitee.com/lyt-top/vue-next-admin/issues/I58U75
// https://gitee.com/lyt-top/vue-next-admin/issues/I59RXK
nextTick(() => {
setTimeout(() => {
if (themeConfig.value.isCacheTagsView) cachedViews.value = Session.get('tagsViewList').map((item: any) => item.name);
}, 0);
});
});
//
onUnmounted(() => {
proxy.mittBus.off('onTagsViewRefreshRouterView', () => {});