mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +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()
|
||||
);
|
||||
// 默认全选。这里会和默认值\回填值逻辑冲突,所以如果有配置source则不执行默认全选
|
||||
if (multiple && defaultCheckAll && options.length && !source) {
|
||||
if (multiple && defaultCheckAll && formItem.filteredOptions?.length && !source) {
|
||||
this.defaultCheckAll();
|
||||
}
|
||||
}
|
||||
@ -721,7 +721,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
||||
@autobind
|
||||
async initOptions(data: any) {
|
||||
await this.reloadOptions(false, true);
|
||||
const {formItem, name, multiple, defaultCheckAll, options} = this.props;
|
||||
const {formItem, name, multiple, defaultCheckAll} = this.props;
|
||||
if (!formItem) {
|
||||
return;
|
||||
}
|
||||
@ -730,7 +730,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
||||
}
|
||||
|
||||
// 默认全选
|
||||
if (multiple && defaultCheckAll && options.length) {
|
||||
if (multiple && defaultCheckAll && formItem.filteredOptions?.length) {
|
||||
this.defaultCheckAll();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user