javascript - vue导入highcharts-more时遇到问题

标签 javascript vue.js highcharts

我正在尝试在 Highcharts 中创建 BoxPlot。它似乎需要一个名为 highcharts-more 的模块。我在导入时遇到问题。

我是这样导入的:

import { Chart } from 'highcharts-vue';
import more from 'highcharts/highcharts-more';

more(Chart);

但是在浏览器控制台中出现以下错误:

Uncaught TypeError: Cannot read property 'parts/Globals.js' of undefined
    at eval (highcharts-more.js?33c6:8)
    at eval (BoxPlot.vue?7d00:19)
    at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/BoxPlot.vue?vue&type=script&lang=js& (app.js:933)
    at __webpack_require__ (app.js:770)
    at fn (app.js:130)
    at eval (BoxPlot.vue?8bce:1)
    at Module../src/components/BoxPlot.vue?vue&type=script&lang=js& (app.js:2420)
    at __webpack_require__ (app.js:770)
    at fn (app.js:130)
    at eval (BoxPlot.vue?67a8:1)

我做错了什么?

编辑 我使用的是 highcharts 版本 7.1.3 和 highcharts-vue 1.3.5。

最佳答案

您需要使用 Highcharts 初始化 highcharts-more 模块:

import { Chart } from 'highcharts-vue';
import Highcharts from 'highcharts';
import more from 'highcharts/highcharts-more';

more(Highcharts);
<小时/>

文档: https://github.com/highcharts/highcharts-vue#importing-highcharts-modules

关于javascript - vue导入highcharts-more时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57727192/

相关文章:

javascript - Google 图表工具日期格式

javascript - Recorder.js 计算和偏移记录延迟

javascript - Highcharts 热图点的透明度取决于值

javascript - Highchart Js 柱形图堆叠和分组

javascript - 网络图表节点关系节点合并->highcharts

javascript - 将 JQuery 验证器分配给全局范围?

javascript - 如何在重定向之前保持请求完成

vue.js - vue : Update vue from 2. 5 to 2.6.8 又出现问题 [Vue warn]: Failed to mount component: template or render function not defined

javascript - Vue.js : Vuetify server side Datatable search filter not working

javascript - 在 vuejs 2.0.0 中选择的占位符