get请求
<button @click="get">发送请求</button>
<script>
export default {
data() {
return {
......
}
},
methods: {
get(){
uni.request({
url:"https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata",
success(res) {
console.log(res)
}
})
}
}
}
</script>
这样点击按钮会发送一个 get 请求,打印下结果:
数据缓存
三个异步接口
【存储数据】
<button @click="setStorage">存储数据</button>
<script>
export default {
......
methods: {
setStorage(