style: rename getDerivedStateFromProps to getDerivedState
parent
04b7d3a934
commit
af69044a67
|
@ -161,7 +161,7 @@ const Select = {
|
|||
return {
|
||||
...state,
|
||||
_mirrorInputValue: state._inputValue, // https://github.com/vueComponent/ant-design-vue/issues/1458
|
||||
...this.getDerivedStateFromProps(props, state),
|
||||
...this.getDerivedState(props, state),
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -179,7 +179,7 @@ const Select = {
|
|||
},
|
||||
watch: {
|
||||
__propsSymbol__() {
|
||||
Object.assign(this.$data, this.getDerivedStateFromProps(getOptionProps(this), this.$data));
|
||||
Object.assign(this.$data, this.getDerivedState(getOptionProps(this), this.$data));
|
||||
},
|
||||
'$data._inputValue'(val) {
|
||||
this.$data._mirrorInputValue = val;
|
||||
|
@ -210,7 +210,7 @@ const Select = {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
getDerivedStateFromProps(nextProps, prevState) {
|
||||
getDerivedState(nextProps, prevState) {
|
||||
const optionsInfo = prevState._skipBuildOptionsInfo
|
||||
? prevState._optionsInfo
|
||||
: this.getOptionsInfoFromProps(nextProps, prevState);
|
||||
|
|
|
@ -9,7 +9,7 @@ import { createRef } from '../util';
|
|||
// onTreeNodeSelect: PropTypes.func.isRequired,
|
||||
// onTreeNodeCheck: PropTypes.func.isRequired,
|
||||
// }
|
||||
function getDerivedStateFromProps(nextProps, prevState) {
|
||||
function getDerivedState(nextProps, prevState) {
|
||||
const {
|
||||
_prevProps: prevProps = {},
|
||||
_loadedKeys: loadedKeys,
|
||||
|
@ -106,7 +106,7 @@ const BasePopup = {
|
|||
},
|
||||
watch: {
|
||||
__propsSymbol__() {
|
||||
const state = getDerivedStateFromProps(this.$props, this.$data);
|
||||
const state = getDerivedState(this.$props, this.$data);
|
||||
this.setState(state);
|
||||
},
|
||||
},
|
||||
|
@ -124,14 +124,14 @@ const BasePopup = {
|
|||
const state = {
|
||||
_keyList: [],
|
||||
_expandedKeyList: expandedKeyList,
|
||||
// Cache `expandedKeyList` when tree is in filter. This is used in `getDerivedStateFromProps`
|
||||
// Cache `expandedKeyList` when tree is in filter. This is used in `getDerivedState`
|
||||
_cachedExpandedKeyList: [],
|
||||
_loadedKeys: [],
|
||||
_prevProps: {},
|
||||
};
|
||||
return {
|
||||
...state,
|
||||
...getDerivedStateFromProps(this.$props, state),
|
||||
...getDerivedState(this.$props, state),
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -187,7 +187,7 @@ const Select = {
|
|||
_treeNodes: undefined,
|
||||
_filteredTreeNodes: undefined,
|
||||
};
|
||||
const newState = this.getDerivedStateFromProps(this.$props, state);
|
||||
const newState = this.getDerivedState(this.$props, state);
|
||||
return {
|
||||
...state,
|
||||
...newState,
|
||||
|
@ -215,7 +215,7 @@ const Select = {
|
|||
watch: {
|
||||
...getWatch(['treeData', 'defaultValue', 'value']),
|
||||
__propsSymbol__() {
|
||||
const state = this.getDerivedStateFromProps(this.$props, this.$data);
|
||||
const state = this.getDerivedState(this.$props, this.$data);
|
||||
this.setState(state);
|
||||
this.needSyncKeys = {};
|
||||
},
|
||||
|
@ -266,7 +266,7 @@ const Select = {
|
|||
},
|
||||
|
||||
methods: {
|
||||
getDerivedStateFromProps(nextProps, prevState) {
|
||||
getDerivedState(nextProps, prevState) {
|
||||
const h = this.$createElement;
|
||||
const { _prevProps: prevProps = {} } = prevState;
|
||||
const {
|
||||
|
|
|
@ -128,7 +128,7 @@ const Tree = {
|
|||
};
|
||||
return {
|
||||
...state,
|
||||
...this.getDerivedStateFromProps(getOptionProps(this), state),
|
||||
...this.getDerivedState(getOptionProps(this), state),
|
||||
};
|
||||
},
|
||||
provide() {
|
||||
|
@ -148,13 +148,13 @@ const Tree = {
|
|||
'loadedKeys',
|
||||
]),
|
||||
__propsSymbol__() {
|
||||
this.setState(this.getDerivedStateFromProps(getOptionProps(this), this.$data));
|
||||
this.setState(this.getDerivedState(getOptionProps(this), this.$data));
|
||||
this.needSyncKeys = {};
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
getDerivedStateFromProps(props, prevState) {
|
||||
getDerivedState(props, prevState) {
|
||||
const { _prevProps } = prevState;
|
||||
const newState = {
|
||||
_prevProps: { ...props },
|
||||
|
|
Loading…
Reference in New Issue