| | |
| | | import store from './store' |
| | | import ElementUI from 'element-ui' |
| | | import './assets/style/element-variables.scss' |
| | | import { ElementTiptapPlugin } from 'element-tiptap' |
| | | import 'element-tiptap/lib/index.css' |
| | | import VueClipboard from 'vue-clipboard2' |
| | | import directives from './directives' |
| | | import filters from './filters' |
| | | import plugins from './plugins' |
| | | import { mapState, mapMutations } from 'vuex' |
| | | import { fetchMenuTree } from './api/system/menu' |
| | | import preventReClick from '@/directives/directive' |
| | | import Treeselect from '@riophae/vue-treeselect' |
| | | import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
| | | Vue.component('treeselect', Treeselect) |
| | | |
| | | Vue.use(preventReClick) |
| | | Vue.config.productionTip = false |
| | | Vue.use(ElementUI, { |
| | | size: 'small' |
| | | }) |
| | | Vue.use(ElementTiptapPlugin, { |
| | | lang: 'zh' |
| | | }) |
| | | Vue.use(VueClipboard) |
| | | Vue.use(directives) |
| | |
| | | this.$store.commit('resetMenus') |
| | | // 获取菜单 |
| | | const storeMenus = this.$store.state.menuData.list |
| | | const storeTopMenus = this.$store.state.topMenuList.list |
| | | if (storeMenus.length > 0 && this.homePage == null) { |
| | | this.setHomePage(storeMenus[0]) |
| | | } |
| | | await fetchMenuTree() |
| | | .then(menus => { |
| | | .then(allmenus => { |
| | | // 添加菜单 |
| | | var menus = allmenus.filter(item => { |
| | | return item.type !== 1 |
| | | }) |
| | | var topList = allmenus.filter(item => { |
| | | return item.type === 1 |
| | | }) |
| | | console.log(topList) |
| | | storeMenus.push.apply(storeMenus, menus) |
| | | storeTopMenus.push.apply(storeTopMenus, topList) |
| | | // 添加路由 |
| | | this.__addRouters(storeMenus) |
| | | // 404 |