From b16213f109bab23f8685f11c4f48727d7d5a3cd4 Mon Sep 17 00:00:00 2001 From: murmur Date: Fri, 28 Jun 2024 19:09:00 +0800 Subject: [PATCH] update cfg, disable button when input-number is empty --- main.aardio | 9 +++-- res/cfg.json | 110 +++++++++++++++++++++++++-------------------------- 2 files changed, 60 insertions(+), 59 deletions(-) diff --git a/main.aardio b/main.aardio index 32c3c5f..917a45b 100644 --- a/main.aardio +++ b/main.aardio @@ -1,10 +1,11 @@ //低代码框架 amis import win.ui; /*DSG{{*/ -var winform = win.form(text="WebView2 - 调用百度低代码前端框架 amis";right=966;bottom=622;border="none";maximize=1) +var winform = win.form(text="WebView2 - 调用百度低代码前端框架 amis";right=966;bottom=622;border="none";) winform.add( -bk={cls="bk";left=0;top=-1;right=967;bottom=30;bgcolor=10789024;dl=1;dr=1;dt=1;z=1}; -custom={cls="custom";text="自定义控件";left=-1;top=32;right=966;bottom=623;db=1;dl=1;dr=1;dt=1;z=2} +bk={cls="bk";left=0;top=-1;right=967;bottom=30;bgcolor=10789024;dl=1;dr=1;dt=1;z=1;}; +custom={cls="custom";text="自定义控件";left=-1;top=32;right=966;bottom=623;db=1;dl=1;dr=1;dt=1;z=2;}; + ) /*}}*/ @@ -110,7 +111,7 @@ schema = function(v){ } udpSend = function(d){ - console.log(d) + console.dumpJson(d) } diff --git a/res/cfg.json b/res/cfg.json index 4be0ca6..a62222f 100644 --- a/res/cfg.json +++ b/res/cfg.json @@ -105,61 +105,61 @@ ], "id": "u:b6649c1b1585" }, - { - "type": "input-number", - "label": "数字输入", - "name": "number", - "keyboard": true, - "id": "u:d10a773ce8ee", - "step": 12, - "displayMode": "base", - "size": "full", - "mode": "inline", - "hint": "比如输入 a-xxxx-xxx", - "required": true, - "min": 225000, - "max": 500000, - "value": 225000, - "kilobitSeparator": true, - "suffix": "", - "unitOptions": [ - { - "label": "kHz", - "value": "k" - } - ] - }, - { - "type": "button", - "label": "按钮10", - "onEvent": { - "click": { - "actions": [ - { - "ignoreError": false, - "actionType": "ajax", - "outputVar": "responseResult", - "options": {}, - "api": { - "url": "/sendData", - "method": "post", - "requestAdaptor": "", - "adaptor": "", - "messages": {}, - "data": { - "aa": "${number}" - } - }, - "expression": "${number!=\"\"}" - } - ] - } - }, - "id": "u:c72878bb1458", - "size": "md", - "block": false, - "disabledOn": "${number!=\"\"}" - }, + + { + "type": "input-number", + "label": "数字输入", + "name": "freq", + "keyboard": true, + "id": "numberInput", + "step": 12, + "displayMode": "base", + "size": "full", + "mode": "inline", + "hint": "请输入一个225000到500000之间的数字", + "required": true, + "min": 225000, + "max": 500000, + "value":"225000", + "kilobitSeparator": true, + "unitOptions": [ + { + "label": "kHz" + } + ] + }, + { + "type": "button", + "label": "提交", + "id": "submitButton", + "size": "md", + "block": false, + "disabledOn": "freq === undefined || freq === ''", + "onEvent": { + "click": { + "actions": [ + { + "ignoreError": false, + "actionType": "ajax", + "outputVar": "responseResult", + "api": { + "url": "/sendData", + "method": "post", + "data": { + "frequency": "${freq}" + } + }, + "messages": { + "success": "数据已成功发送", + "failed": "发送数据失败,请重试" + } + } + ] + } + } + }, + + { "type": "button-group-select", "name": "buttonGroupSelect",