tiny-engine/packages/vue-generator/test/testcases/sfc/case03/blocks.schema.json

159 lines
3.7 KiB
JSON

{
"componentName": "Block",
"fileName": "StateAccessor",
"css": "",
"props": {},
"state": {
"fullName": {
"defaultValue": "",
"accessor": {
"getter": {
"type": "JSFunction",
"value": "function getter() {\r\n this.state.fullName = `${this.props.firstName} ${this.props.lastName}`\r\n}"
},
"setter": {
"type": "JSFunction",
"value": "function setter() {\r\n const [firstName, lastName] = this.state.fullName.split(' ')\r\n this.emit('update:firstName', firstName)\r\n this.emit('update:lastName', lastName)\r\n}"
}
}
}
},
"methods": {},
"lifeCycles": {},
"children": [
{
"componentName": "TinyForm",
"props": {
"labelWidth": "80px",
"labelPosition": "top"
},
"children": [
{
"componentName": "TinyFormItem",
"props": {
"label": "全名"
},
"children": [
{
"componentName": "TinyInput",
"props": {
"placeholder": "请输入全名",
"modelValue": {
"type": "JSExpression",
"value": "this.state.fullName",
"model": true
}
},
"id": "acdd0030"
}
],
"id": "6140da6b"
},
{
"componentName": "TinyFormItem",
"props": {},
"children": [
{
"componentName": "TinyButton",
"props": {
"text": "提交",
"type": "primary"
},
"id": "d2b35138"
},
{
"componentName": "TinyButton",
"props": {
"text": "重置",
"style": "margin-left: 10px"
},
"id": "89f92a92"
}
],
"id": "2e93998e"
}
],
"id": "88ecfcff"
}
],
"schema": {
"properties": [
{
"label": {
"zh_CN": "基础信息"
},
"description": {
"zh_CN": "基础信息"
},
"collapse": {
"number": 6,
"text": {
"zh_CN": "显示更多"
}
},
"content": [
{
"property": "firstName",
"type": "String",
"defaultValue": "",
"label": {
"text": {
"zh_CN": "姓氏"
}
},
"cols": 12,
"rules": [],
"hidden": false,
"required": true,
"readOnly": false,
"disabled": false,
"widget": {
"component": "MetaInput",
"props": {}
}
},
{
"property": "lastName",
"type": "String",
"defaultValue": "",
"label": {
"text": {
"zh_CN": "名字"
}
},
"cols": 12,
"rules": [],
"hidden": false,
"required": true,
"readOnly": false,
"disabled": false,
"widget": {
"component": "MetaInput",
"props": {}
}
}
]
}
],
"events": {
"onUpdate:firstName": {
"label": {
"zh_CN": "firstName变化时触发"
},
"description": {
"zh_CN": ""
}
},
"onUpdate:lastName": {
"label": {
"zh_CN": "lastName变化时触发"
},
"description": {
"zh_CN": ""
}
}
},
"slots": {}
}
}