研发图纸文件管理系统-前端项目
he wei
2025-03-13 ec8d9f802eac6841165425b228ef56474636fa9a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const TabsPagePlugin = {
  install(Vue) {
    Vue.mixin({
      methods: {
        $closePage(closeRoute, nextRoute) {
          const event = new CustomEvent('page:close', {detail:{closeRoute, nextRoute}})
          window.dispatchEvent(event)
        },
        $refreshPage(route) {
          const path = typeof route === 'object' ? route.path : route
          const event = new CustomEvent('page:refresh', {detail:{pageKey: path}})
          window.dispatchEvent(event)
        },
        $openPage(route, title) {
          this.$setPageTitle(route, title)
          this.$router.push(route)
        },
        $setPageTitle(route, title) {
          if (title) {
            let path = typeof route === 'object' ? route.path : route
            path = path && path.split('?')[0]
            this.$store.commit('setting/setCustomTitle', {path, title})
          }
        }
      },
      computed: {
        customTitle() {
          const customTitles = this.$store.state.setting.customTitles
          const path = this.$route.path.split('?')[0]
          const custom = customTitles.find(item => item.path === path)
          return custom && custom.title
        }
      }
    })
  }
}
 
export default TabsPagePlugin