import Vue from "vue";
import App from "./App.vue";
import ElementUI from "element-ui";
import router from "./router";
import "element-ui/lib/theme-chalk/index.css";
import store from "./store";
import "./assets/fonts/font.css"

import { i18n } from './language/index.js'
Vue.config.productionTip = false;
import moment from "moment";

//定义一个全局过滤器实现日期格式化
Vue.filter("datefmt", function (input, fmtstring) {
  //当input为时间戳时，需转为Number类型
  // 使用momentjs这个日期格式化类库实现日期的格式化功能
  return moment(input).format(fmtstring);
});
Vue.prototype.$moment = moment;
Vue.prototype.$store = store;

Vue.use(ElementUI);

window.updateLanguage = switchLanguage

// 切换中英文方法
function switchLanguage(string) {
  if (string == 'zh') {
    i18n.locale = 'zh'
  } else {
    i18n.locale = 'en'
  }
}
// updateLanguage()
new Vue({
  router,
  i18n,
  render: (h) => h(App),
}).$mount("#app");
