我正在尝试将vue-highcharts
与moment.js
一起使用。
<template>
<highcharts :constructor-type="'stockChart'" :options="stockOptions" :updateArgs="[true, false]"></highcharts>
</template>
<script>
...
stockOptions: {
series: [{
data: ''
}],
plotOptions: {
series: {
turboThreshold: 0
}
},
chart: {
type: 'area'
},
time: {
timezone: 'America/Sao_paulo'
}
}
...
</script>
但是我收到此错误:
Highcharts Error #25
Can't find Moment.js library
Using the global.timezone option requires the Moment.js library to be loaded.
该如何解决?
答案 0 :(得分:5)
Highcharts将检查type Test = {a: number}
范围内的moment.js
库是否可用,这就是为什么需要在此处添加它。首先,您需要导入两个模块:
window
然后运行将其分配为import Moment from "moment";
import MomentTimeZone from "moment-timezone";
变量,并调用window
模块函数:
moment-timezone