fix local
parent
a00e1285b1
commit
aaa0267b7b
|
@ -11,12 +11,12 @@ export default {
|
||||||
children: PropTypes.func,
|
children: PropTypes.func,
|
||||||
},
|
},
|
||||||
inject: {
|
inject: {
|
||||||
antLocale: { default: {}},
|
localeData: { default: {}},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getLocale () {
|
getLocale () {
|
||||||
const { componentName, defaultLocale } = this
|
const { componentName, defaultLocale } = this
|
||||||
const { antLocale } = this
|
const { antLocale } = this.localeData
|
||||||
const localeFromContext = antLocale && antLocale[componentName]
|
const localeFromContext = antLocale && antLocale[componentName]
|
||||||
return {
|
return {
|
||||||
...(typeof defaultLocale === 'function' ? defaultLocale() : defaultLocale),
|
...(typeof defaultLocale === 'function' ? defaultLocale() : defaultLocale),
|
||||||
|
@ -25,7 +25,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getLocaleCode () {
|
getLocaleCode () {
|
||||||
const { antLocale } = this
|
const { antLocale } = this.localeData
|
||||||
const localeCode = antLocale && antLocale.locale
|
const localeCode = antLocale && antLocale.locale
|
||||||
// Had use LocaleProvide but didn't set locale
|
// Had use LocaleProvide but didn't set locale
|
||||||
if (antLocale && antLocale.exist && !localeCode) {
|
if (antLocale && antLocale.exist && !localeCode) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
locale: PropTypes.object.def({}),
|
locale: PropTypes.object.def({}),
|
||||||
},
|
},
|
||||||
provide () {
|
data () {
|
||||||
return {
|
return {
|
||||||
antLocale: {
|
antLocale: {
|
||||||
...this.locale,
|
...this.locale,
|
||||||
|
@ -38,8 +38,17 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
provide () {
|
||||||
|
return {
|
||||||
|
localeData: this.$data,
|
||||||
|
}
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
locale (val) {
|
locale (val) {
|
||||||
|
this.antLocale = {
|
||||||
|
...this.locale,
|
||||||
|
exist: true,
|
||||||
|
}
|
||||||
setMomentLocale(val)
|
setMomentLocale(val)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue