Merge branch 'fix/minor-bugs-lianjie.lj' into 'release/0.9.6'

大纲树loop状态判断有误



See merge request !938034
This commit is contained in:
高凯 2020-08-18 12:23:17 +08:00
commit 8388cbf11e

View File

@ -6,7 +6,6 @@ import {
PropsMap, PropsMap,
PropsList, PropsList,
NodeData, NodeData,
TitleContent,
I18nData, I18nData,
SlotSchema, SlotSchema,
PageSchema, PageSchema,
@ -396,9 +395,23 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
return v != null && v !== '' && v !== true; return v != null && v !== '' && v !== true;
} }
/**
* has loop when 1. loop is validArray with length > 1 ; OR 2. loop is variable object
* @return boolean, has loop config or not
*/
@computed hasLoop() { @computed hasLoop() {
const v = this.getExtraProp('loop', false)?.getValue(); const value = this.getExtraProp('loop', false)?.getValue();
return v != null && v !== ''; if (value === undefined || value === null) {
return false;
}
if (Array.isArray(value) && value.length > 0) {
return true;
}
if (isJSExpression(value)) {
return true;
}
return false;
} }
wrapWith(schema: Schema) { wrapWith(schema: Schema) {