import Vue from 'vue';
import VueRouter from 'vue-router';
import VConsole from 'vconsole';


// 或者使用配置参数来初始化，详情见文档
// 开发环境和qa环境 打开debug
const debug = /dev-t?-?|qa-t?-?|sl-t?-?|808[0-9]/.test(window.location.href);
if (debug && process.env.NODE_ENV !== 'dev') {
  window.vConsole = new VConsole(
    // { theme: 'dark' }
  );
}
import './plugins/install';
import App from './App.vue';
import store from './store/index.js';

// ui 组件
import {
  Icon,
  Checkbox,
  CheckboxGroup,
  RadioGroup,
  Radio,
  Field,
  Popup,
  CountDown,
  Switch,
  Skeleton,
  Dialog,
  NumberKeyboard,
  Divider,
  Stepper,
  Loading
} from 'vant';

import router from './routes/index.js'; // 注册页面路由
import wx from '@/utils/js_sdk/weixin'; // 接入微信JSDK
import '@/utils/filters'; // 注册 vue 过滤器
import request from '@/utils/request.js'; //

// 项目整体初始化逻辑
import {clientInit} from '@/common/js/clientInit'
clientInit();

// 注册全局组件
import componentsInstall from './components/install';

Vue.use(componentsInstall);

window.wx = wx;
Vue.prototype.$wx = window.wx;
Vue.prototype.$store = store;
Vue.prototype.$request = request;
//
Vue.config.productionTip = false;
App.mpType = 'app';
Vue.use(VueRouter);
Vue.use(Icon)
  .use(Checkbox)
  .use(CheckboxGroup)
  .use(RadioGroup)
  .use(Radio)
  .use(Field)
  .use(Popup)
  .use(CountDown)
  .use(Skeleton)
  .use(Switch)
  .use(Dialog)
  .use(NumberKeyboard)
  .use(Divider)
  .use(Loading)
  .use(Stepper);
  

Vue.config.ignoredElements = ['wx-open-launch-weapp'];

const app = new Vue({
  store,
  router,
  el: '#app',
  ...App,
});
app.$mount();
