加载实体 Jmeter 模块时出现Highcharts错误

gv8xihay  于 2022-11-10  发布在  Highcharts
关注(0)|答案(1)|浏览(177)

我把highcharts和highcharts-vue一起用。
我有几个插件加载和工作的预期:

import Vue from 'vue';
import Highcharts from 'highcharts';
import HighchartsVue from 'highcharts-vue';
import stockInit from 'highcharts/modules/stock';
import noDataToDisplay from 'highcharts/modules/no-data-to-display';
import solidGauge from 'highcharts/modules/solid-gauge';

if (typeof Highcharts === 'object' && typeof window !== 'undefined') {
  stockInit(Highcharts);
  solidGauge(Highcharts);
  noDataToDisplay(Highcharts);
}

Vue.use(HighchartsVue, {tagName: 'charts'});

但是我刚刚添加的实体计量器模块产生了一个错误:

Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (<anonymous>)
    at a (solid-gauge.js:15:327)
    at eval (solid-gauge.js:15:388)
    at eval (solid-gauge.js:16:308)
    at eval (solid-gauge.js:19:291)
    at f (solid-gauge.js:11:175)
    at eval (solid-gauge.js:14:442)
    at eval (highcharts.js:34:72)
    at Module../plugins/highcharts.js (app.js:5244:1)
    at __webpack_require__ (runtime.js:854:30)

我几乎看不出我如何能从这一步进一步调查。
我确实更新了我的highcharts npm依赖关系到10.0.1,但错误仍然发生。
我们将非常感谢您的帮助!
干杯

u2nhd7ah

u2nhd7ah1#

您需要在导入和初始化solid-gauge之前导入和初始化highcharts-more模块。

import Vue from 'vue';
import Highcharts from 'highcharts';
import HighchartsVue from 'highcharts-vue';
import hcMore from 'highcharts/highcharts-more';
import stockInit from 'highcharts/modules/stock';
import noDataToDisplay from 'highcharts/modules/no-data-to-display';
import solidGauge from 'highcharts/modules/solid-gauge';

if (typeof Highcharts === 'object' && typeof window !== 'undefined') {
  hcMore(Highcharts);
  stockInit(Highcharts);
  solidGauge(Highcharts);
  noDataToDisplay(Highcharts);
}

现场演示:https://jsfiddle.net/BlackLabel/2dqL70hy/

相关问题