【问题标题】:"Uncaught TypeError: Cannot read properties of undefined (reading 'extend')" when using vue-3d-model package\"Uncaught TypeError: Cannot read properties of undefined (reading \'extend\')\" 使用 vue-3d-model 包时
【发布时间】:2023-02-11 18:08:19
【问题描述】:

我正在尝试使用 vue-3d-model library,但在页面加载之前我遇到了这个错误“Uncaught TypeError: Cannot read properties of undefined (reading 'extend')”。

我正在像这样导入库:

<script>
    import ModelStl from 'vue-3d-model';
    export default {
        components: { ModelStl }, ...

这些是我的依赖项:

  "dependencies": {
    "core-js": "^3.8.3",
    "jest": "^29.1.2",
    "jest-editor-support": "^30.2.0",
    "vue": "^3.2.13",
    "vue-3d-model": "^1.4.1"

从这个错误信息中搜索,问题似乎是因为 Vue3 不支持 Vue.extend(这似乎是问题所在) enter image description here

请注意,这是一个 javascript 文件,但是当我查看该项目的 github 存储库时,等效文件是打字稿,并且描述说它支持 Vue 3。 https://github.com/hujiulong/vue-3d-model/blob/master/src/index.ts

我在这里错过了什么?

我尝试导入一个包。我期待它开箱即用。也许我安装了错误的版本或什么?

【问题讨论】:

    标签: vue.js vuejs3


    【解决方案1】:

    我也遇到了同样的问题。我把vue-3d-model版本升级到2.0.0,问题解决了。

    【讨论】:

    • 您可以使用“ npm install vue-3d-model@2.0.0-alpha.4 ”
    猜你喜欢
    • 2021-11-10
    • 2022-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-09
    • 2022-07-21
    • 2022-07-22
    • 2022-09-26
    相关资源
    最近更新 更多