fix(editor): set root 可能没有items

This commit is contained in:
roymondchen 2023-02-09 16:57:22 +08:00
parent 89fa321088
commit aa566e9535

View File

@ -108,8 +108,8 @@ class Editor extends BaseService {
throw new Error('root 不能为数组');
}
if (isObject(value) && !(value instanceof StageCore) && !(value instanceof Map)) {
this.state.pageLength = value.items.length;
if (value && isObject(value) && !(value instanceof StageCore) && !(value instanceof Map)) {
this.state.pageLength = value.items?.length || 0;
} else {
this.state.pageLength = 0;
}