Skip to main content
Version: 3.5

ViewElement 页面元素

1. 结构声明

class ViewElement extends BaseNode {
tag: string;
name: string = '';
staticClass?: string;
staticStyle?: string;
authDescription?: string;
slotTarget?: string;
slotScope?: string;
bindAttrs: Array<BindAttribute>;
bindEvents: Array<BindEvent>;
bindDirectives: Array<BindDirective>;
bindRoles: Array<string>;
bindStyles: Array<BindStyle>;
children: Array<ViewElement>;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "ViewElement",
"tag": "u-button",
"name": "button_2",
"bindAttrs": [
{
"concept": "BindAttribute",
"name": "color",
"type": "string",
"value": "primary",
"playground": []
},
{
"concept": "BindAttribute",
"name": "text",
"type": "string",
"value": "创 建",
"playground": []
}
],
"bindEvents": [
{
"concept": "BindEvent",
"name": "click",
"logics": [
{
"concept": "Logic",
"name": "click",
"params": [],
"returns": [],
"variables": [],
"body": [
{
"concept": "Start",
"label": "开始"
},
{
"uuid": "0550e0f6863a4d849ee643d16336e420",
"concept": "CallLogic",
"label": "弹出消息",
"calleeNamespace": "nasl.ui",
"calleeName": "showMessage",
"shortcut": true,
"arguments": [
{
"concept": "Argument",
"keyword": "text",
"expression": {
"concept": "StringLiteral",
"value": "点击了“创 建”按钮"
}
}
]
},
{
"concept": "End",
"label": "结束"
}
],
"playground": []
},
{
"concept": "Logic",
"name": "create",
"params": [],
"returns": [],
"variables": [],
"body": [
{
"concept": "Start",
"label": "开始"
},
{
"concept": "Assignment",
"label": "赋值",
"left": {
"concept": "Identifier",
"namespace": "",
"name": "input"
},
"right": {
"concept": "CallFunction",
"label": "调用逻辑",
"calleeNamespace": "nasl.util",
"calleeName": "Clone",
"arguments": [
{
"concept": "Argument",
"keyword": "obj",
"expression": {
"concept": "Identifier",
"namespace": "",
"name": "student"
}
}
]
}
},
{
"uuid": "43a14fc183ed4b1bab03a839ea7fce9f",
"concept": "CallLogic",
"label": "调用逻辑",
"calleeNamespace": "elements.saveModal_1.logics",
"calleeName": "open",
"arguments": []
},
{
"concept": "End",
"label": "结束"
}
],
"playground": []
}
]
}
],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": []
}

(2) 示例

AST 如下:

{
"concept": "ViewElement",
"tag": "u-modal",
"name": "modal_1",
"bindAttrs": [
{
"concept": "BindAttribute",
"name": "visible",
"type": "dynamic",
"expression": {
"concept": "Identifier",
"namespace": "",
"name": "modalVisible"
},
"rules": [],
"sync": true,
"playground": []
}
],
"bindEvents": [],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": [
{
"concept": "ViewElement",
"tag": "template",
"name": "template_1",
"slotTarget": "foot",
"slotScope": "",
"bindAttrs": [],
"bindEvents": [],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": [
{
"concept": "ViewElement",
"tag": "u-linear-layout",
"name": "linear_layout_1",
"bindAttrs": [
{
"concept": "BindAttribute",
"name": "justify",
"type": "string",
"value": "center",
"rules": [],
"playground": []
}
],
"bindEvents": [],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": [
{
"concept": "ViewElement",
"tag": "u-button",
"name": "button_1",
"bindAttrs": [
{
"concept": "BindAttribute",
"name": "color",
"type": "string",
"value": "primary",
"rules": [],
"playground": []
},
{
"concept": "BindAttribute",
"name": "text",
"type": "string",
"value": "确 定",
"rules": [],
"playground": []
}
],
"bindEvents": [],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": []
},
{
"concept": "ViewElement",
"tag": "u-button",
"name": "button_2",
"bindAttrs": [
{
"concept": "BindAttribute",
"name": "text",
"type": "string",
"value": "取 消",
"rules": [],
"playground": []
}
],
"bindEvents": [
{
"concept": "BindEvent",
"name": "click",
"logics": [
{
"concept": "Logic",
"name": "click",
"params": [],
"returns": [],
"variables": [],
"body": [
{
"concept": "Start",
"label": "开始"
},
{
"uuid": "bc414eb6611e417c92a25ca5c125a2ed",
"concept": "CallLogic",
"label": "调用逻辑",
"calleeNamespace": "elements.modal_1.logics",
"calleeName": "close",
"arguments": []
},
{
"concept": "End",
"label": "结束"
}
],
"playground": []
}
]
}
],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": []
}
]
}
]
},
{
"concept": "ViewElement",
"tag": "template",
"name": "template_2",
"slotTarget": "body",
"slotScope": "",
"bindAttrs": [],
"bindEvents": [],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": [
{
"concept": "ViewElement",
"tag": "u-text",
"name": "text_1",
"bindAttrs": [
{
"concept": "BindAttribute",
"name": "text",
"type": "string",
"value": "内容",
"rules": [],
"playground": []
}
],
"bindEvents": [],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": []
}
]
},
{
"concept": "ViewElement",
"tag": "template",
"name": "template_3",
"slotTarget": "title",
"slotScope": "",
"bindAttrs": [],
"bindEvents": [],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": [
{
"concept": "ViewElement",
"tag": "u-text",
"name": "text_2",
"bindAttrs": [
{
"concept": "BindAttribute",
"name": "text",
"type": "string",
"value": "标题",
"rules": [],
"playground": []
}
],
"bindEvents": [],
"bindDirectives": [],
"bindRoles": [],
"bindStyles": [],
"children": []
}
]
}
]
}