onPullDownRefresh: function () {
wx.showNavigationBarLoading()
wx.showLoading({
title: '加载中',
})
var that = this
var that1 = this
wx.request({
url: 'https://xxxxxxxxxxxxxx', //仅为示例,并非真实的接口地址
data: {
loc: 'room2'
},
header: {
'content-type': 'application/json'
},
success: function (res) {
console.log(res.data[0].update)
wx.hideLoading();
that.setData({
msg: res.data[0].update
});
that.ecComponent = that.selectComponent('#mychart-dom-bar');
that.ecComponent.init((canvas, width, height) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
setOption(chart, res.data[0].tem, '温度', '°C');
that.chart = chart;
return chart;
});
that1.ecComponent = that1.selectComponent('#mychart-dom-bar1');
that1.ecComponent.init((canvas, width, height) => {
const chart1 = echarts.init(canvas, null, {
width: width,
height: height
});
setOption(chart1, res.data[0].hum, '湿度', '%');
that1.chart1 = chart1;
return chart1;
});
wx.stopPullDownRefresh;
wx.hideNavigationBarLoading()
}
})
console.log("n11111111111111g");
}
|