一.实体传参
1.前端VUE写法
<script setup lang="ts" >
import axios from 'axios'
const SetParameter = async (Name: any, Val: any) => {
let pa = { Name: Name, Value: Val }
axios.post(global_const.WEBAPI + `Hanslaser/SetParameter`, pa).then(response => {
}).catch(err => {
})
}
2.后端webapi
/// <summary>
/// 设置激光打标参数
/// </summary>
/// <param name="Name"></param>
/// <param name="val"></param>
[HttpPost(Name = "SetParameter")]
public int SetParameter(ParamModel pm)
{
return SqliteHelper.SetParamter(pm.Name, pm.Value);
}
文章介绍了如何在前端Vue应用中使用TS编写异步函数SetParameter,通过axios库向后端WebAPI发送POST请求,传递Name和Value参数。后端接收到参数后,通过ParamModel类进行处理并调用SQLiteHelper设置激光打标参数。
948

被折叠的 条评论
为什么被折叠?



