import Vue from 'vue'
import App from './App.vue'
import store from './store'
import $ from 'jquery'
import  axios from 'axios'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
import '../public/bootstrap3/css/bootstrap.min.css'
import '../public/bootstrap3/js/bootstrap.min.js'
import { Button, Card,Drawer,Cascader, Carousel,CarouselItem , Pagination  } from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import router from './router'


Vue.use(Button);
Vue.use(Card);
Vue.use(Drawer);
Vue.use(Cascader);
Vue.use(Carousel);
Vue.use(CarouselItem);
Vue.use(Pagination);
Vue.use(VueAwesomeSwiper);
Vue.config.productionTip = false


router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  if (to.meta.keyword) {
    var dMeta = document.createElement('meta');
    var sName = 'keywords';
    dMeta.setAttribute('name', sName);
    dMeta.setAttribute('content', to.meta.keyword);
    document.head.appendChild(dMeta);
  }
  if (to.meta.description) {
    var dMeta = document.createElement('meta');
    var sName = 'description';
    dMeta.setAttribute('name', sName);
    dMeta.setAttribute('content', to.meta.description);
    document.head.appendChild(dMeta);
  }
  next()
})

router.afterEach((to,from,next)=>{
  window.scrollTo(0,0)

})


axios.defaults.baseURL='/website-api';
new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app')

