post button's label

This commit is contained in:
CSSC-WORK\murmur 2024-06-28 08:33:59 +08:00
parent 1d69e3d01b
commit 12539b6b2f
2 changed files with 84 additions and 261 deletions

View File

@ -1,13 +1,16 @@
{ {
"type": "page", "type": "page",
"title": "Hello world", "title": "Hello world",
"regions": [
"body"
],
"body": [ "body": [
{ {
"type": "tpl", "type": "tpl",
"id": "u:f439a8330e02",
"tpl": "初始页面", "tpl": "初始页面",
"wrapperComponent": "", "wrapperComponent": "",
"inline": false, "inline": false
"id": "u:f439a8330e02"
}, },
{ {
"type": "grid", "type": "grid",
@ -33,6 +36,9 @@
{ {
"type": "button-toolbar", "type": "button-toolbar",
"label": "按钮工具栏", "label": "按钮工具栏",
"data": {
"x": "yy"
},
"buttons": [ "buttons": [
{ {
"type": "button", "type": "button",
@ -40,17 +46,15 @@
"onEvent": { "onEvent": {
"click": { "click": {
"actions": [ "actions": [
{ "api": { {
"url": "/sendData", "ignoreError": false,
"method": "post", "script": "const buttonText = context.props.label;\ndoAction({\n actionType: 'ajax',\n args: {\n api: {\n url: '/sendData',\n method: 'post',\n data: {\n buttonLabel: buttonText\n }\n }\n }\n});\n",
"requestAdaptor": "", "actionType": "custom"
"adaptor": "", }
"messages": {}, ]
"dataType": "json"
}}]
} }
}, },
"id": "u:d5479075ff42" "id": "u:sendButtonText"
}, },
{ {
"type": "button", "type": "button",
@ -58,20 +62,11 @@
"onEvent": { "onEvent": {
"click": { "click": {
"actions": [ "actions": [
{ {
"ignoreError": false, "ignoreError": false,
"outputVar": "responseResult", "actionType": "custom",
"actionType": "ajax", "script": "const buttonText = context.props.label;\ndoAction({\n actionType: 'ajax',\n args: {\n api: {\n url: '/sendData',\n method: 'post',\n data: {\n buttonLabel: buttonText\n },\n successMessage: '请求成功',\n errorMessage: '请求失败'\n }\n }\n});\n"
"options": {}, }
"api": {
"url": "/sendData",
"method": "post",
"requestAdaptor": "",
"adaptor": "",
"messages": {},
"data":{"&": "$$","sel":"${this.label}"}
}
}
] ]
} }
}, },
@ -116,23 +111,54 @@
"name": "number", "name": "number",
"keyboard": true, "keyboard": true,
"id": "u:d10a773ce8ee", "id": "u:d10a773ce8ee",
"step": 1, "step": 12,
"displayMode": "base", "displayMode": "base",
"size": "full", "size": "full",
"mode": "inline", "mode": "inline",
"hint": "比如输入 a-xxxx-xxx" "hint": "比如输入 a-xxxx-xxx",
"required": true,
"min": 225000,
"max": 500000,
"value": 225000,
"kilobitSeparator": true,
"suffix": "",
"unitOptions": [
{
"label": "kHz",
"value": "k"
}
]
}, },
{ {
"type": "button", "type": "button",
"label": "按钮", "label": "按钮10",
"onEvent": { "onEvent": {
"click": { "click": {
"actions": [] "actions": [
{
"ignoreError": false,
"actionType": "ajax",
"outputVar": "responseResult",
"options": {},
"api": {
"url": "/sendData",
"method": "post",
"requestAdaptor": "",
"adaptor": "",
"messages": {},
"data": {
"aa": "${number}"
}
},
"expression": "${number!=\"\"}"
}
]
} }
}, },
"id": "u:c72878bb1458", "id": "u:c72878bb1458",
"size": "md", "size": "md",
"block": false "block": false,
"disabledOn": "${number!=\"\"}"
}, },
{ {
"type": "button-group-select", "type": "button-group-select",
@ -158,233 +184,7 @@
}, },
{ {
"type": "collapse", "type": "collapse",
"key": "2", "header": "调试",
"header": "超短波",
"body": [
{
"type": "button-toolbar",
"label": "按钮工具栏",
"buttons": [
{
"type": "button",
"label": "按钮1",
"onEvent": {
"click": {
"actions": []
}
},
"id": "u:d5479075ff42"
},
{
"type": "button",
"label": "按钮2",
"onEvent": {
"click": {
"actions": []
}
},
"id": "u:8eae2c306cc5"
},
{
"type": "button",
"label": "按钮",
"id": "u:c440483f217b"
},
{
"type": "button",
"label": "按钮",
"id": "u:5eb80129858e"
},
{
"type": "button",
"label": "按钮",
"id": "u:92b3fbb4a8e5"
},
{
"type": "button",
"label": "按钮",
"id": "u:fcec0c70c54c"
},
{
"type": "button",
"label": "按钮",
"id": "u:68b551bbf8cb"
},
{
"type": "button",
"label": "按钮",
"id": "u:5bb6c2e1889e"
}
],
"id": "u:b6649c1b1585"
}
],
"id": "u:b4de28d2cd49",
"active": false
},
{
"type": "collapse",
"header": "北斗",
"body": [
{
"type": "button-toolbar",
"label": "按钮工具栏",
"buttons": [
{
"type": "button",
"label": "按钮1",
"onEvent": {
"click": {
"actions": []
}
},
"id": "u:d5479075ff42"
},
{
"type": "button",
"label": "按钮2",
"onEvent": {
"click": {
"actions": []
}
},
"id": "u:8eae2c306cc5"
},
{
"type": "button",
"label": "按钮",
"id": "u:c440483f217b"
},
{
"type": "button",
"label": "按钮",
"id": "u:5eb80129858e"
},
{
"type": "button",
"label": "按钮",
"id": "u:92b3fbb4a8e5"
},
{
"type": "button",
"label": "按钮",
"id": "u:fcec0c70c54c"
},
{
"type": "button",
"label": "按钮",
"id": "u:68b551bbf8cb"
},
{
"type": "button",
"label": "按钮",
"id": "u:5bb6c2e1889e"
}
],
"id": "u:b6649c1b1585"
},
{
"type": "input-number",
"label": "数字输入",
"name": "number",
"keyboard": true,
"id": "u:d10a773ce8ee",
"step": 1,
"displayMode": "base",
"size": "full",
"mode": "inline"
},
{
"type": "button",
"label": "按钮",
"onEvent": {
"click": {
"actions": []
}
},
"id": "u:c72878bb1458",
"size": "md",
"block": false
},
{
"type": "button-group-select",
"name": "buttonGroupSelect",
"label": "单选",
"inline": false,
"options": [
{
"label": "选项1",
"value": "a"
},
{
"label": "选项2",
"value": "b"
}
],
"id": "u:5112d83e3943",
"multiple": false,
"value": "a"
},
{
"type": "button-group-select",
"name": "buttonGroupSelect2",
"label": "单选",
"inline": false,
"options": [
{
"label": "选项1",
"value": "a"
},
{
"label": "选项2",
"value": "b"
}
],
"id": "u:03b1b5d4011e",
"multiple": false,
"value": "b",
"size": "md",
"tiled": false
}
],
"key": "3",
"id": "u:3a8ad47cac52"
},
{
"type": "collapse",
"header": "数据链",
"body": [
{
"type": "tpl",
"tpl": "内容",
"wrapperComponent": "",
"inline": false,
"id": "u:ac3d89c9a857"
}
],
"key": "4",
"id": "u:4ed37447dabf"
},
{
"type": "collapse",
"header": "密码",
"body": [
{
"type": "tpl",
"tpl": "内容",
"wrapperComponent": "",
"inline": false,
"id": "u:2721f190d07b"
}
],
"key": "5",
"id": "u:5bf93a5153cf"
},
{
"type": "collapse",
"header": "天通",
"body": [ "body": [
{ {
"type": "tpl", "type": "tpl",
@ -408,11 +208,11 @@
} }
], ],
"id": "u:ddf6e6d384e7", "id": "u:ddf6e6d384e7",
"asideResizor": false,
"pullRefresh": { "pullRefresh": {
"disabled": true "disabled": true
}, },
"regions": [ "data": {
"body" "x": "xx"
] },
"asideResizor": false
} }

23
本地文档例程.bat Normal file
View File

@ -0,0 +1,23 @@
@echo off
:: 切换到指定目录
cd /d E:\github.Prj\amis
:: 检查端口8888是否被占用
netstat -an | find "8888" >nul
if %errorlevel% equ 0 (
echo 服务已经在运行
) else (
:: 启动npm并保持窗口打开
start cmd /k "npm start"
:: 等待15秒以确保npm服务器启动
timeout /t 3 /nobreak
)
:: 打开默认浏览器并访问http://localhost:8888/
start "" "http://localhost:8888/"
start "" "http://localhost:8888/packages/amis-editor/#/"
:: 结束脚本
exit