version information is "element-ui": "^ 2.3.3", "vue": "^ 2.5.2"
projects need to use element-ui
paging component
-- Pagination
, and need to use multiple languages ( vue-i18n
) to support switching between Chinese and English. According to the official document reference, but keep reporting errors, the error message is as follows:
import messages from "./language"
import VueI18n from "vue-i18n"
import eleLocale from "element-ui/lib/locale";
import enLocale from "element-ui/lib/locale/lang/en"
import zhLocale from "element-ui/lib/locale/lang/zh-CN"
Vue.use(VueI18n)
Vue.use(Pagination)
const i18n = new VueI18n({
locale: Vue.config.lang || "en",
messages,
})
eleLocale.i18n((key, value) => i18n.t(key, value)) //element
cn.js file
import zhLocale from "element-ui/lib/locale/lang/zh-CN"
const cn= {
//
common: {
notice: "",
more: "",
},
zhLocale,
}
export default cn;
en.js omitted.