错误:data is not defined;at "pages/Flower/flower" page lifeCycleMethod onLoad function
ReferenceError: data is not defined
-
页面的初始数据
*/
data: {
hasList: false, // 列表是否有数据
},/**
生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.request({
url: 'http://localhost:3631/api/Flowers/Show',
method: 'GET',
data: {},
header: {
'content-type': 'application/json',
'Authorization': 'BasicAuth ' + data.data
},
success: function (res) {
console.log(res)
that.setData({
hasList: true,
carts: res.data
})
}
})
}