更新vue-i18n到最新版本,修复iview不兼容最新版本的bug

This commit is contained in:
zhigang.li 2018-06-07 15:47:49 +08:00
parent cb4ea670fa
commit c6e512987c
4 changed files with 23 additions and 19 deletions

6
package-lock.json generated
View File

@ -14881,9 +14881,9 @@
"dev": true
},
"vue-i18n": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-5.0.3.tgz",
"integrity": "sha1-ttlsyDJgQjfmE53kceDUyCCu2+0="
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-7.8.0.tgz",
"integrity": "sha512-06lw8q6+hWhcCq1O5hw7pZ0CYKcY8CFV4iUjKctz5VRXTVvYC/soEfEQyWrQ3qjYHNCtePv/YieArm3pF70JVg=="
},
"vue-loader": {
"version": "15.0.11",

View File

@ -23,7 +23,7 @@
"sortablejs": "^1.7.0",
"tinymce": "^4.7.11",
"vue": "^2.5.10",
"vue-i18n": "^5.0.3",
"vue-i18n": "^7.8.0",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},

View File

@ -18,18 +18,20 @@ let lang = 'zh-CN'
Vue.config.lang = lang
// vue-i18n 6.x+写法
// Vue.locale = () => {}
// const messages = {
// 'zh-CN': Object.assign(zhCnLocale, customZhCn),
// 'zh-TW': Object.assign(zhTwLocale, customZhTw),
// 'en-US': Object.assign(enUsLocale, customEnUs)
// }
// const i18n = new VueI18n({
// locale: lang,
// messages
// })
Vue.locale = () => {}
const messages = {
'zh-CN': Object.assign(zhCnLocale, customZhCn),
'zh-TW': Object.assign(zhTwLocale, customZhTw),
'en-US': Object.assign(enUsLocale, customEnUs)
}
const i18n = new VueI18n({
locale: lang,
messages
})
export default i18n
// vue-i18n 5.x写法
Vue.locale('zh-CN', Object.assign(zhCnLocale, customZhCn))
Vue.locale('en-US', Object.assign(zhTwLocale, customZhTw))
Vue.locale('zh-TW', Object.assign(enUsLocale, customEnUs))
// Vue.locale('zh-CN', Object.assign(zhCnLocale, customZhCn))
// Vue.locale('en-US', Object.assign(zhTwLocale, customZhTw))
// Vue.locale('zh-TW', Object.assign(enUsLocale, customEnUs))

View File

@ -5,14 +5,16 @@ import App from './App'
import router from './router'
import store from './store'
import iView from 'iview'
import '@/locale'
import i18n from '@/locale'
import config from '@/config'
import 'iview/dist/styles/iview.css'
import '@/assets/icons/iconfont.css'
import env from '../config/env'
if (env === 'development') require('@/mock')
Vue.use(iView)
Vue.use(iView, {
i18n: (key, value) => i18n.t(key, value)
})
Vue.config.productionTip = false
/**
* @description 全局注册应用配置