Vue 3 HighchartsVue

neskvpey  于 5个月前  发布在  Highcharts
关注(0)|答案(1)|浏览(68)

Uncaught ReferenceError:Highcharts is not defined.
我正在使用Vue3 App。
在我的app.js文件中,我声明,

import HighchartsVue from 'highcharts-vue';

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
    setup({ el, App, props, plugin }) {
        return createApp({ render: () => h(App, props) })
            .use(plugin)
            .use(ZiggyVue, Ziggy)
            .use(HighchartsVue)
            .mount(el);
    }
});

字符串
然后在我的组件.vue文件中,我可以毫无问题地使用<highcharts>组件。
但是我不能使用Highcharts.dateFormat()方法,它返回错误Uncaught ReferenceError: Highcharts is not defined
我正在尝试将其应用于此工具提示。

tooltip: {
        formatter: function() {
            return 'Amount' + Highcharts.dateFormat('%e %b %Y', this.x);
        }
    },


如何使用选项API在Vuejs上使用Highcharts.dateFormat()方法?

neekobn8

neekobn81#

你需要在使用前导入它

import Highcharts from 'highcharts'

...

tooltip: {
        formatter: function() {
            return 'Amount' + Highcharts.dateFormat('%e %b %Y', this.x);
        }
    },

字符串

相关问题