Skip to main content
Version: Latest(3.11)

BindAttribute 元素绑定属性

1. 结构声明

class BindAttribute extends BaseNode {
name: string = '';
type?: 'string' | 'static' | 'dynamic';
value?: string | boolean | number;
expression?: LogicItem;
expressionExample?: string;
destination?: Destination;
externalDestination?: ExternalDestination;
rules?: Array<ValidationRule>;
assignee?: Assignee;
assigneeV2?: AssigneeV2;
model?: boolean;
sync?: boolean;
playground: Array<LogicItem>;
i18nKey?: uuid;
}

2. 节点示例

(1) 字符串属性

AST 如下:

{
"concept": "BindAttribute",
"name": "color",
"type": "string",
"value": "primary",
"playground": []
}

对应的代码如下:

color = 'primary'

(2) 非字符串的静态类型属性

AST 如下:

{
"concept": "BindAttribute",
"name": "min",
"type": "static",
"value": "24",
"playground": []
}

对应的代码如下:

min = 24

(3) 双向绑定属性

AST 如下:

{
"concept": "BindAttribute",
"name": "visible",
"type": "dynamic",
"expression": {
"concept": "Identifier",
"namespace": "",
"name": "modalVisible"
},
"rules": [],
"sync": true,
"playground": []
}

对应的代码如下:

visible = modalVisible