研发图纸文件管理系统-前端项目
chenghongxing
2020-09-26 435b2ff5855e7e538689dbf650cd34b2cf44f3b0
chore: optimize the code of caching tabs;
1个文件已修改
13 ■■■■ 已修改文件
src/layouts/tabs/TabsView.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layouts/tabs/TabsView.vue
@@ -228,16 +228,17 @@
     * 加载缓存的 tabs
     */
    loadCachedTabs() {
      const cachedTabs = sessionStorage.getItem(process.env.VUE_APP_TBAS_KEY)
      if (cachedTabs) {
      const cachedTabsStr = sessionStorage.getItem(process.env.VUE_APP_TBAS_KEY)
      if (cachedTabsStr) {
        try {
          const tabs = JSON.parse(cachedTabs)
          if (tabs.length > 0) {
            this.pageList = tabs
          const cachedTabs = JSON.parse(cachedTabsStr)
          if (cachedTabs.length > 0) {
            this.pageList = cachedTabs
          }
          sessionStorage.removeItem(process.env.VUE_APP_TBAS_KEY)
        } catch (e) {
          console.warn('failed to load cached tabs, got exception:', e)
        } finally {
          sessionStorage.removeItem(process.env.VUE_APP_TBAS_KEY)
        }
      }
    },