vue-echarts
vue-echarts copied to clipboard
Vue 2 组件type无效
请确认
- [X] 我可以确认这个问题无法在 ECharts 项目本身中复现。
您是如何将 Vue-ECharts 引入项目的?
通过 ES 模块 import
版本信息
dependencies:
echarts 5.3.3
vue 2.7.8
vue-echarts 6.2.3
问题详情
这个
ECOption
是我传入的option的type,不是组件prop的type。没有intellisense
如果我在vue2.d.ts
里做如下修改
diff --git a/dist/index.vue2.d.ts b/dist/index.vue2.d.ts
--- a/dist/index.vue2.d.ts
+++ b/dist/index.vue2.d.ts
@@ -1,4 +1,5 @@
-import { DefineComponent, Ref } from 'vue-demi';
+import { Ref } from 'vue-demi';
+import { DefineComponent } from '@vue/runtime-dom';
import { init, SetOptionOpts } from 'echarts/core';
type InitType = typeof init;
v-chart
的type就生效了
貌似是因为Vue 2 没有从@vue/runtime-dom
export DefineComponent
这个type
是不是应该提个issue让Vue export这个type呢,不然手动定义组件类型还要额外装一个依赖,大佬你怎么看🤔
另外如果这么改的话又出现了我之前提到的type问题 https://github.com/ecomfe/vue-echarts/issues/626 ,这个手动定义的type不符合Vue.Component
要求的type,不过全局使用的话也不是什么大问题,as any
一次就行了。
问题复现
Ignore!