// const { default: brandOption } = require("../../option/brandOption"); const app = getApp(); import histogram from "../../option/columnarOption" Component({ data: { showChart: true, // brandOption: histogram(data1,data2,'#0084FF'), // modelOption: histogram(data1,data2,'#20CC62'), }, onShow() { this.getTabBar().init(); }, lifetimes: { attached() { let sTimeType = wx.getStorageSync("sTimeType") || 34; let sStartTime = wx.getStorageSync("sStartTime") || ''; let sEndTime = wx.getStorageSync("sEndTime") || ''; this.getData(sTimeType, sStartTime, sEndTime); } }, methods: { changeTime(e){ let sTimeType = e.detail.sTimeType; let sStartTime = e.detail.sStartTime; let sEndTime = e.detail.sEndTime; this.getData(sTimeType, sStartTime, sEndTime); }, getData(sTimeType, sStartTime, sEndTime) { wx.showToast({ title: '加载中', icon: 'loading', duration: 300000 }) app.globalData.request( { action: 'getWeiYiCountHome0528', sType: 'Home', sQueryType:1, sTimeType: sTimeType, sStartTime: sStartTime, sEndTime: sEndTime, }).then(res => { const arr = [] const arr1=[] res.forEach(ele => { arr.push(ele.key); arr1.push(ele.value) }) this.setData({ brandOption: histogram(arr,arr1,"#0084FF") }) setTimeout(() =>{ wx.hideToast(); },500) console.log('333',arr) console.log('333',arr1) }) }, priceSel(e){ this.setData({ intervalSel: e.currentTarget.dataset.index }) } } })