import Vue from 'vue'
import ElementUI from 'element-ui'
import VueI8n from 'vue-i18n'
import fetch1,{fetch} from '../../utils/fetch'
import fetch2 from '../../utils/fetch.bpa'
import {baseUrl,pageurl} from '../../utils/url';

// wn 国际化加入elementui组件
// import enLocale from 'element-ui/lib/locale/lang/en' // 英语
import zhLocale from 'element-ui/lib/locale/lang/zh-CN' // 简体中文
// import twLocale from 'element-ui/lib/locale/lang/zh-TW' // 繁体中文
// import deLocale from 'element-ui/lib/locale/lang/de' // 德语
// import jaLocale from 'element-ui/lib/locale/lang/ja' // 日语
// import itLocale from 'element-ui/lib/locale/lang/it' // 意大利语
import App from './index.vue'
const localeCN = require('../../../i18n-locales/cn.js').default
import "../../../assets/styles/index.scss";


Vue.use(VueI8n)
Vue.use(ElementUI);

window.Vue = Vue
const language = localStorage.getItem('language')
const i18n = new VueI8n({
  locale: language || 'cn',
  messages: {
    'cn': Object.assign(localeCN, zhLocale),
    // 'en': Object.assign(require('../../../i18n-locales/cn.js'), enLocale),
    // 'de': Object.assign(require('@/assets/i18n-locales/de.js'), deLocale),
    // 'ja': Object.assign(require('@/assets/i18n-locales/ja.js'), jaLocale),
    // 'tw': Object.assign(require('@/assets/i18n-locales/tw.js'), twLocale),
    // 'it': Object.assign(require('@/assets/i18n-locales/it.js'), itLocale),
  }
})
// wn 注册i18n
Vue.use(ElementUI,
  {
    size: 'mini', zIndex: 3000,
    i18n: (key, value) => i18n.t(key, value)
  })
  Vue.prototype.$ELEMENT = { size: 'mini' };

export const renderReleateEleDialog = (el) => {
  setTimeout(() => {
    new Vue({
      el: el,
      data: function(){
        return {
          releateEleInfo: {}
        }
      },
      // router,
      // store,
      i18n,
      template: '<App/>',
      // components: { App }
      render: h => h(App)
    })
  }, 300);

}


export default {
  renderReleateEleDialog
}
