scriptexport default data return prompt responseData ; methods submitData unirequest url httplocalhost3000data 假设接口地址为 httplocalhost3000data method PO
<script>
export default {
data() {
return {
prompt: "",
responseData: "",
loading: false
};
},
methods: {
submitData() {
this.loading = true; // 显示等待框
uni.request({
url: "http://localhost:3000/data", // 假设接口地址为 http://localhost:3000/data
method: "POST",
data: {
prompt: this.prompt,
keys: "sk4"
},
success: res => {
this.responseData = JSON.stringify(res.data);
},
complete: () => {
this.loading = false; // 隐藏等待框
}
});
}
}
};
</script
原文地址: https://www.cveoy.top/t/topic/crCX 著作权归作者所有。请勿转载和采集!