请求前,显示
const fetch = require('../../utils/fetch')
Page({
data: {
categories: []
},
gotoTest:function(){
// 显示loading
wx.showLoading({
title: 'Loading...',
})
fetch('/categories')
.then(res => {
if (res.statusCode===404){
wx.hideLoading()
}
this.setData({ categories: res.data })
// 加载完毕,关闭loading
wx.hideLoading()
})
},
})