| | |
| | | import 'element-ui/lib/theme-chalk/index.css' |
| | | import App from './App.vue' |
| | | import router from './router' |
| | | import dialogDrag from './directives/dialogDrag' |
| | | |
| | | Vue.use(ElementUI) |
| | | Vue.directive('dialog-drag', dialogDrag) // 让 el-dialog 可拖动(Element UI 2.x 无 draggable 属性) |
| | | Vue.config.productionTip = false |
| | | |
| | | // 全局登出:清除登录态并回登录页(各页面侧边栏「退出登录」菜单共用) |
| | | Vue.mixin({ |
| | | methods: { |
| | | // el-menu 同路由导航(NavigationDuplicated)时 Element UI 会把高亮回滚为点击前旧值; |
| | | // 点击后延迟一个宏任务强制纠正(宏任务晚于 push 的微任务回调,保证最终高亮正确)。 |
| | | onMenuSelect(index) { |
| | | setTimeout(() => { |
| | | const menu = this.$refs.sideMenu |
| | | if (menu && menu.activeIndex !== index) menu.activeIndex = index |
| | | }, 0) |
| | | }, |
| | | logout() { |
| | | sessionStorage.removeItem('token') |
| | | sessionStorage.removeItem('username') |