pull/165/head
tjz 7 years ago
parent a00e1285b1
commit aaa0267b7b

@ -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) {

@ -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