Frontend 前端
前端节点,包含前端的基本信息。
1. 结构声明
- TS Declaration
- JSON Schema
class Frontend extends BaseNode {
name: string = '';
title: string;
type: 'pc' | 'h5';
path: string;
documentTitle: string;
documentIcon: string;
bindEvents: Array<BindEvent>;
views: Array<View>;
variables: Array<FrontendVariable>;
theme: Theme = new Theme();
globalScaleEnabled: boolean = false;
canvasWidth: double = 0;
i18nInfo?: I18nInfo;
}
{
"type": "object",
"properties": {
"composedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"title": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"pc",
"h5"
]
},
"path": {
"type": "string"
},
"documentTitle": {
"type": "string"
},
"documentIcon": {
"type": "string"
},
"bindEvents": {
"type": "array",
"items": {
"$ref": "#/definitions/BindEvent"
}
},
"views": {
"type": "array",
"items": {
"$ref": "#/definitions/View"
}
},
"variables": {
"type": "array",
"items": {
"$ref": "#/definitions/FrontendVariable"
}
},
"theme": {
"$ref": "#/definitions/Theme"
},
"globalScaleEnabled": {
"type": "boolean"
},
"canvasWidth": {
"$ref": "#/definitions/double"
},
"i18nInfo": {
"$ref": "#/definitions/I18nInfo"
}
},
"required": [
"name",
"title",
"type",
"path",
"documentTitle",
"documentIcon",
"bindEvents",
"views",
"variables",
"theme",
"globalScaleEnabled",
"canvasWidth"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Frontend",
"name": "pc",
"title": "PC端",
"type": "pc",
"path": "/",
"documentTitle": "选课系统PC端",
"documentIcon": "icon.png",
"bindEvents": [],
"views": [],
"variables": [],
"globalScaleEnabled": false,
"canvasWidth": 0,
"theme": {
"concept": "Theme",
"title": "默认主题",
"variableMap": {}
}
}
concept: Frontend
name: pc
title: PC端
type: pc
path: /
documentTitle: 选课系统PC端
documentIcon: icon.png
bindEvents: []
views: []
variables: []
globalScaleEnabled: false
canvasWidth: 0
theme:
concept: Theme
title: 默认主题
variableMap: {}
对应的代码如下:
- 文本化 NASL
@(
title = "PC端",
path = "/",
documentTitle = "选课系统PC端",
documentIcon = "icon.png",
globalScaleEnabled = false,
canvasWidth = 0,
)
frontend pc pc {
}
(2) 示例
AST 如下:
- JSON
- YAML
{
"concept": "Frontend",
"name": "h5",
"title": "H5端",
"type": "h5",
"path": "/",
"documentTitle": "选课系统H5端",
"documentIcon": "icon.png",
"bindEvents": [],
"views": [],
"variables": [],
"globalScaleEnabled": false,
"canvasWidth": 0,
"theme": {
"concept": "Theme",
"title": "默认主题",
"variableMap": {}
}
}
concept: Frontend
name: h5
title: H5端
type: h5
path: /
documentTitle: 选课系统H5端
documentIcon: icon.png
bindEvents: []
views: []
variables: []
globalScaleEnabled: false
canvasWidth: 0
theme:
concept: Theme
title: 默认主题
variableMap: {}
对应的代码如下:
- 文本化 NASL
@(
title = "H5端",
path = "/",
documentTitle = "选课系统H5端",
documentIcon = "icon.png",
globalScaleEnabled = false,
canvasWidth = 0,
)
frontend h5 h5 {
}