forked from epicmaxco/vuestic-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
43 lines (37 loc) · 1.02 KB
/
main.js
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
39
40
41
42
43
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import BootstrapVue from 'bootstrap-vue'
import VeeValidate from 'vee-validate'
import App from './App'
import store from './store'
import router from './router'
import { sync } from 'vuex-router-sync'
import VuesticPlugin from 'src/components/vuestic-components/vuestic-components-plugin'
Vue.use(VuesticPlugin)
Vue.use(BootstrapVue)
Vue.use(VeeValidate)
sync(store, router)
let mediaHandler = () => {
if (window.matchMedia(store.getters.config.windowMatchSizeLg).matches) {
store.dispatch('toggleSidebar', true)
} else {
store.dispatch('toggleSidebar', false)
}
}
router.beforeEach((to, from, next) => {
store.commit('setLoading', true)
next()
})
router.afterEach((to, from) => {
mediaHandler()
store.commit('setLoading', false)
})
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
template: '<App/>',
components: { App }
})