vue--更改同一图表的数据

260 阅读1分钟

切换不同的按钮,图标显示对应的数据,放在watch

// 各大成绩分布是得分还是得分率  ***监听是否为得分率还是得分,赋给图表不同的数据
        isScore: function(newVal) {
            if (newVal) {
                this.chartTitle = '综合得分'
                this.chartDataY = this.chartCompleteScoreData;
                this.maxY = this.chartScore[0]
            } else {
                this.chartTitle = '得分率'
                this.chartDataY = this.chartRates
                this.maxY = 100
            }
        },

把区域的键值,分别用两个键分别存 因为你要键值全部要用

for (var areaKey in res.data.data.area) {
    this.areaOptions.push({ value: areaKey, label:   res.data.data.area[areaKey] })
}