mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 22:58:15 +00:00
fix(designer/node.ts): fix hasLoop logic
This commit is contained in:
parent
5d643124c4
commit
99a7288696
@ -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) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user