Vuejs:映射图表的值时出错-TypeError:无法读取未定义的属性“ map”

时间:2020-05-06 14:41:38

标签: javascript vue.js

我正在使用vue-apexharts来绘制图表,图表数据来自api。

              this.statistics = response.data;
              this.statistics.consent.map((consent) => {
                this.series.push(consent.count);
              });

但是显示错误-TypeError:无法读取未定义的属性“ map”

1 个答案:

答案 0 :(得分:1)

以某种方式要执行map()函数时,this.statistics.consent为空/空/未定义。尝试通过console.log(this.statistics.consent)对其进行调试。希望对您有帮助,祝您好运!