New file |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | |
| | | import 'moment/locale/zh-cn' |
| | | import layer from 'vue-layer' |
| | | import 'vue-layer/lib/vue-layer.css' |
| | | import beforeRouteChange from './assets/js/beforeRouteChange' |
| | | |
| | | Vue.prototype.$layer = layer(Vue); |
| | | |
| | |
| | | Vue.use(Viser) |
| | | Vue.use(Plugins) |
| | | |
| | | // 全局混入页面路由守卫 |
| | | Vue.mixin(beforeRouteChange); |
| | | |
| | | bootstrap({router, store, i18n, message: Vue.prototype.$message}) |
| | | |
| | | new Vue({ |