1.npm install babel-plugin-component -D .babelrc then replace plugins file in the root directory
2. components and custom in English English
import VueI18n from 'vue-i18n' import enLocale from 'element-ui/lib/locale/lang/en' import zhLocale from 'element-ui/lib/locale/lang/zh-CN' import ElementLocale from 'element-ui/lib/locale' Vue.use(VueI18n) Vue.use(DatePicker) const messages = { en: { message: 'hello', ...enLocale }, zh: { message: '你好', ...zhLocale } } // the Create instance with VueI18n Options const the i18n = new new VueI18n ({ the locale: ' EN ' , // SET the locale messages, // SET the locale messages }) ElementLocale.i18n ((Key, value) => I18n.t (Key, value)) new new Vue ({ EL: ' #app ' , the i18n, method No // official website, the written here can Router, Components: the App {}, Template: ' <the App /> ' })
3 ,. English switch this. $ I18n.locale = 'cn'