【发布时间】:2021-04-28 16:00:01
【问题描述】:
我正在一个名为componentDidMount的函数中创建highcharts,代码可以在下面找到。
componentDidMount() {
const p = this.props
const highcharts = p.highcharts || Highcharts;
const constructorType = p.constructorType || 'chart';
// Create chart
this.chart = highcharts[constructorType](this.container.current, Object.assign({}, p.options));
}
我不知道为什么会出现错误
highcharts.js:formatted:1 Uncaught ReferenceError: Highcharts is not defined
at e.drawEmpty (highcharts.js:formatted:1)
at e.redrawPoints (highcharts.js:formatted:1)
at e.render (highcharts.js:formatted:1)
at highcharts.js:formatted:1
at Array.forEach (<anonymous>)
at B.renderSeries (highcharts.js:formatted:1)
at B.render (highcharts.js:formatted:1)
at B.firstRender (highcharts.js:formatted:1)
at B.<anonymous> (highcharts.js:formatted:1)
at g.fireEvent (highcharts.js:formatted:1)
at B.init (highcharts.js:formatted:1)
at B.getArgs (highcharts.js:formatted:1)
at new B (highcharts.js:formatted:1)
at Object.c.chart (highcharts.js:formatted:1)
at ReactHighcharts.componentDidMount (ReactHighcharts.jsx:28)
at ReactHighcharts.componentDidMount (highcharts.js:formatted:1)
有人能帮我找出问题吗?
【问题讨论】:
-
Highcharts 变量从何而来?你在哪里定义它?您能否为您的读者提供更多背景信息?
-
您能在某个在线编辑器上重现您的问题吗?
标签: javascript reactjs highcharts