Browse Source

fix local

pull/165/head
tjz 7 years ago
parent
commit
aaa0267b7b
  1. 6
      components/locale-provider/LocaleReceiver.vue
  2. 11
      components/locale-provider/index.vue

6
components/locale-provider/LocaleReceiver.vue

@ -11,12 +11,12 @@ export default {
children: PropTypes.func,
},
inject: {
antLocale: { default: {}},
localeData: { default: {}},
},
methods: {
getLocale () {
const { componentName, defaultLocale } = this
const { antLocale } = this
const { antLocale } = this.localeData
const localeFromContext = antLocale && antLocale[componentName]
return {
...(typeof defaultLocale === 'function' ? defaultLocale() : defaultLocale),
@ -25,7 +25,7 @@ export default {
},
getLocaleCode () {
const { antLocale } = this
const { antLocale } = this.localeData
const localeCode = antLocale && antLocale.locale
// Had use LocaleProvide but didn't set locale
if (antLocale && antLocale.exist && !localeCode) {

11
components/locale-provider/index.vue

@ -30,7 +30,7 @@ export default {
props: {
locale: PropTypes.object.def({}),
},
provide () {
data () {
return {
antLocale: {
...this.locale,
@ -38,8 +38,17 @@ export default {
},
}
},
provide () {
return {
localeData: this.$data,
}
},
watch: {
locale (val) {
this.antLocale = {
...this.locale,
exist: true,
}
setMomentLocale(val)
},
},

Loading…
Cancel
Save