<template>
<view>
<button @click="get">发送get请求</button>
</view>
</template>
<script>
export default{
// 发送get请求
methods:{
get(){
uni.request({
url: 'https://www.example.com/request', //仅为示例,并非真实接口地址。
data: {
text: 'uni.request'
},
header: {
'custom-header': 'hello' //自定义请求头信息
},
success: (res) => {
console.log(res.data);
this.text = 'request success';
}
});
}
}
}
13.uniapp发送get请求
Guess you like
Origin blog.csdn.net/m0_49714202/article/details/115607571
Ranking