研发图纸文件管理系统-前端项目
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
export default {
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      // 由于页面从非激活状态激活时 不会触发mounted 如果有需求需要定义一个方法 activeFN 在里面定义需要执行的代码
      if (vm.activeFN && 'function' == typeof vm.activeFN) {
        vm.activeFN();
      }
    });
  },
  activated() {
    // 如果有websocket 则初始化
    if (this.openSocket && 'function' == typeof this.openSocket) {
      this.openSocket();
    }
  },
  deactivated () {
    // 如果有 则关闭websocket
    if (this.WSClose && 'function' == typeof this.WSClose) {
      this.WSClose();
    }
  }
}