// 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 App from './App'
import router from '$g/router'
import store from '$g/store'

import '@/assets/css/reset.css'

import directives from './directives'
import filter from '$g/filter'
import baseComponents from '@/components'
import util from '$g/util'
import ajax from '$g/ajax'

Vue.use(directives)
Vue.use(filter)
Vue.use(baseComponents)
Vue.use(util)
//移动端点击300ms延迟处理
const FastClick = require('fastclick')
FastClick.attach(document.body)
router.beforeEach(async (to, from, next) => {
  store.commit('set_remind_control',false)
  if (localStorage.user) {
    let user = JSON.parse(localStorage.user)
    if (user.m_token) {
      let res = await ajax.get('remind/read/count')
      store.commit('set_remind_count',res)
    }
  }
  next()
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: {
    App
  }
})