Try   HackMD

解決 ECharts + vue-echarts 的 dataset 無法渲染的問題

TL;DR

沒想到連 Dataset 本身也是一個 component,所以要記得匯入並 use 它。

// <script setup lang="ts"> import { computed } from 'vue' import { type EChartsOption } from 'echarts' import { use } from 'echarts/core' import { DatasetComponent } from 'echarts/components' import VueECharts from 'vue-echarts' use([ DatasetComponent, ..., ]) const option = computed<EChartsOption>(() => ({ dataset: { ... }, series: { ... }, }))

如果並不在意打包大小,那麼也可以直接一次匯入所有 component,就不需要再呼叫 use() 了。

import "echarts"

官方文件