ecomfe / vue-echarts

Vue.js component for Apache ECharts™.
https://vue-echarts.dev
MIT License
9.75k stars 1.49k forks source link

Vue2 使用报错:has no exported member named 'DefineComponent'. Did you mean 'defineComponent' #632

Closed aurthurxlc closed 2 years ago

aurthurxlc commented 2 years ago

请确认

您是如何将 Vue-ECharts 引入项目的?

通过 ES 模块 import

版本信息

$ npm ls vue echarts vue-echarts
app-name@0.1.0
├─┬ @vue/cli-plugin-babel@4.5.13
│ └─┬ @vue/babel-preset-app@4.5.13
│   └── vue@2.6.14 deduped
├─┬ @vue/cli-plugin-unit-jest@4.5.13
│ └─┬ vue-jest@3.0.7
│   └── vue@2.6.14 deduped
├─┬ @vue/composition-api@1.6.2
│ └── vue@2.6.14 deduped
├─┬ @vue/test-utils@1.0.0-beta.31
│ └── vue@2.6.14 deduped
├── echarts@5.3.3
├─┬ element-ui@2.15.9
│ └── vue@2.6.14 deduped
├─┬ vue-class-component@7.2.6
│ └── vue@2.6.14 deduped
├─┬ vue-echarts@6.1.0
│ ├── echarts@5.3.3 deduped
│ ├─┬ vue-demi@0.12.5
│ │ └── vue@2.6.14 deduped
│ └── vue@2.6.14 deduped
├─┬ vue-particles@1.0.9
│ └── vue@2.6.14 deduped
├─┬ vue-property-decorator@8.5.1
│ └── vue@2.6.14 deduped
├─┬ vue-svgicon@3.2.9
│ └── vue@2.6.14 deduped
├── vue@2.6.14
├─┬ vuex-module-decorators@0.16.1
│ └── vue@2.6.14 deduped
└─┬ vuex@3.6.2
  └── vue@2.6.14 deduped

问题详情

项目环境:Vue2、TypeScript

项目启动报错信息如下:

....../node_modules/vue-echarts/dist/index.vue2.d.ts(1,10):
1:10 '"../../vue-demi/lib"' has no exported member named 'DefineComponent'. Did you mean 'defineComponent'?
  > 1 | import { DefineComponent, Ref } from 'vue-demi';
      |          ^
    2 | import { init, SetOptionOpts } from 'echarts/core';
    3 | 
    4 | type InitType = typeof init;
Version: typescript 4.1.6

问题复现

暂无

gengyong commented 2 years ago

same problem.

ntnyq commented 2 years ago

Make sure you have @vue/composition-api installed and used.

Justineo commented 2 years ago

Please provide a minimal reproduction or we can't help you. (You can try what @ntnyq suggested first.)

reactjser commented 2 years ago

Same question with @vue/composition-api 1.0.0-rc.6.