appsmith使用第三方库进行http请求

安装

image

使用

export default {
	debugMeter: async () => {
		let rID = Number(Select1.selectedOptionValue);
		let metricName = Input6.text;
		let meterAsset = Input7.text;
		let busAddr = Input8.text;
		let meterAddr = Number(Input9.text);
		let registerAddr = Number(Input10.text);
		let registerCount = Number(Input11.text);
		let ratio = Number(Input12.text);
		let result = await ky.post("http://172.16.0.181:9090/debug_meter",{json:{rID,metricName,meterAsset,busAddr,meterAddr,registerAddr,registerCount,ratio}});
		if (result.ok) {
			let data = await result.json();
			showAlert("At "+data.timestamp+" debug meter data is "+data.value,"success");
		}else {
			showAlert("debug meter is failed.","error");
		}
	}
}
posted @ 2023-07-20 15:20  bitterteaer  阅读(35)  评论(0编辑  收藏  举报