// 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 Vuex from 'vuex'
import './style/main.css'
import router from './router'
import Ajax from './util/ajax'
import api from './util/api'
import toolClass from './util/util'
import store from './store'
import Vant from 'vant'
import 'vant/lib/index.css'
Vue.use(Vant)
Vue.use(Vuex)
Vue.config.productionTip = false
Vue.prototype.$api = api
Vue.prototype.$ajax = Ajax
Vue.prototype.toolClass = toolClass
// router.beforeEach((to, from, next) => {
//   console.log(to)
//   console.log(from)
//   let userInfo = localStorage.getItem('userInfo')
//   if (userInfo) {
//     next()
//   } else if (to.name === 'getCode') {
//     next()
//   } else {
//     next({ name: 'getCode', query: { toName: to.name } })
//   }
// })
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
