mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
fix: 修复 minLength maxLength 关联上下文变量的及时性问题 Close: #2864
This commit is contained in:
parent
bfedae3165
commit
a3a97e9a8f
@ -412,7 +412,13 @@ export default class ComboControl extends React.Component<ComboProps> {
|
||||
componentDidUpdate(prevProps: ComboProps) {
|
||||
const props = this.props;
|
||||
|
||||
if (anyChanged(['minLength', 'maxLength', 'value'], prevProps, props)) {
|
||||
if (
|
||||
anyChanged(['minLength', 'maxLength', 'value'], prevProps, props) ||
|
||||
this.resolveVariableProps(prevProps, 'minLength') !==
|
||||
this.resolveVariableProps(props, 'minLength') ||
|
||||
this.resolveVariableProps(prevProps, 'maxLength') !==
|
||||
this.resolveVariableProps(props, 'maxLength')
|
||||
) {
|
||||
const {store, multiple} = props;
|
||||
const values = this.getValueAsArray(props);
|
||||
|
||||
@ -1768,7 +1774,14 @@ export default class ComboControl extends React.Component<ComboProps> {
|
||||
@FormItem({
|
||||
type: 'combo',
|
||||
storeType: ComboStore.name,
|
||||
extendsData: false
|
||||
extendsData: false,
|
||||
shouldComponentUpdate: (props: any, prevProps: any) =>
|
||||
(isPureVariable(props.maxLength) &&
|
||||
resolveVariableAndFilter(prevProps.maxLength, prevProps.data) !==
|
||||
resolveVariableAndFilter(props.maxLength, props.data)) ||
|
||||
(isPureVariable(props.minLength) &&
|
||||
resolveVariableAndFilter(prevProps.minLength, prevProps.data) !==
|
||||
resolveVariableAndFilter(props.minLength, props.data))
|
||||
})
|
||||
export class ComboControlRenderer extends ComboControl {
|
||||
// 支持更新指定索引的值
|
||||
|
Loading…
Reference in New Issue
Block a user