uniapp js 用dom创建form表单 并提交
// 创建一个新的form元素
var form = window.document.createElement('form');
// 设置form的method和action属性
form.method = 'POST';
form.action = 'https://xxx';
// 创建一个input元素
var input = window.document.createElement('input');
input.type = 'hidden';
input.name = 'myData'; // 设置input的name属性
input.value = '这里是需要提交的数据'; // 设置input的value属性
// 将input添加到form中
form.appendChild(input);
// 将form添加到body中
document.body.appendChild(form);
// 提交表单
form.submit();
原文地址:https://blog.csdn.net/weixin_44805839/article/details/140323920
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!