<template>
<view>
<u-button @click="getData">数据请求</u-button>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
// uview 中get请求数据
/*
get和post一样
第一个参数请求接口的地址
第二个参数是提交的数据
第三个参数用来设置请求头
*/
getData(){
this.$u.get('https://cnodejs.org/api/v1/topics',{limit:10}).then(res=>{
console.log(res.data)
});
}
}
}
</script>
<style>
</style>
Uview 中get请求数据
最新推荐文章于 2024-05-15 14:48:08 发布