Skip to content

Commit a07acec

Browse files
committed
fix: locale not work
1 parent 21b4e60 commit a07acec

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

components/locale-provider/index.tsx

+6-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { provide, App, defineComponent, VNode, PropType } from 'vue';
1+
import { provide, App, defineComponent, VNode, PropType, reactive } from 'vue';
22
import PropTypes from '../_util/vue-types';
33
import moment from 'moment';
44
import interopDefault from '../_util/interopDefault';
@@ -43,38 +43,25 @@ const LocaleProvider = defineComponent({
4343
},
4444
ANT_MARK__: PropTypes.string,
4545
},
46-
data() {
47-
warning(
48-
this.ANT_MARK__ === ANT_MARK,
49-
'LocaleProvider',
50-
'`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead',
51-
);
52-
return {
53-
antLocale: {
54-
...this.locale,
55-
exist: true,
56-
},
57-
};
58-
},
5946
setup(props) {
6047
warning(
6148
props.ANT_MARK__ === ANT_MARK,
6249
'LocaleProvider',
6350
'`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead',
6451
);
65-
const data = {
52+
const state = reactive({
6653
antLocale: {
6754
...props.locale,
6855
exist: true,
6956
},
7057
ANT_MARK__: ANT_MARK,
71-
};
72-
provide('localeData', data);
73-
return data;
58+
});
59+
provide('localeData', state);
60+
return { state };
7461
},
7562
watch: {
7663
locale(val) {
77-
this.antLocale = {
64+
this.state.antLocale = {
7865
...val,
7966
exist: true,
8067
};

0 commit comments

Comments
 (0)