mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
fix:修复options数据为空时报错问题 (#2317)
Co-authored-by: qinhaoyan <qinhaoyan@baidu.com>
This commit is contained in:
parent
584187a902
commit
9d660f8a91
@ -298,7 +298,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||||||
() => this.forceUpdate()
|
() => this.forceUpdate()
|
||||||
);
|
);
|
||||||
// 默认全选。这里会和默认值\回填值逻辑冲突,所以如果有配置source则不执行默认全选
|
// 默认全选。这里会和默认值\回填值逻辑冲突,所以如果有配置source则不执行默认全选
|
||||||
if (multiple && defaultCheckAll && options.length && !source) {
|
if (multiple && defaultCheckAll && formItem.filteredOptions?.length && !source) {
|
||||||
this.defaultCheckAll();
|
this.defaultCheckAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -721,7 +721,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||||||
@autobind
|
@autobind
|
||||||
async initOptions(data: any) {
|
async initOptions(data: any) {
|
||||||
await this.reloadOptions(false, true);
|
await this.reloadOptions(false, true);
|
||||||
const {formItem, name, multiple, defaultCheckAll, options} = this.props;
|
const {formItem, name, multiple, defaultCheckAll} = this.props;
|
||||||
if (!formItem) {
|
if (!formItem) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -730,7 +730,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 默认全选
|
// 默认全选
|
||||||
if (multiple && defaultCheckAll && options.length) {
|
if (multiple && defaultCheckAll && formItem.filteredOptions?.length) {
|
||||||
this.defaultCheckAll();
|
this.defaultCheckAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user