最近在做echars的微信小程序,遇到些小知识点,这里记录下
1、去掉echars图表底下的分类标识
将option里面的legend去掉就可以了
legend: {
left: 'center',
top: 'bottom',
// data: ['rose1', 'rose2', 'rose3', 'rose4', 'rose5', 'rose6', 'rose7', 'rose8']
},
2、数组赋值,直接push就好
this.globalData.action.push(res.data[index].action)
3、循环赋值 index是下标哦
for(var index in res.data){
this.globalData.action.push(res.data[index].action)
this.globalData.time.push(res.data[index].time)
}
4、回调函数
wx.request({
url: 'https://timeload.com?userName=liuxiaoxin',
dataType: 'json',
success : res => {
for(var index in res.data){
this.globalData.action.push(res.data[index].action)
this.globalData.time.push(res.data[index].time)
}
if (this.checkRequestTwoCallback) {
this.checkRequestTwoCallback(res)
}
}
})
这段里面回调函数是下面这段
if (this.checkRequestTwoCallback) {
this.checkRequestTwoCallback(res)
}
checkRequestTwoCallback这个名字随便取就好