【发布时间】: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
我在这里错过了什么?
我尝试导入一个包。我期待它开箱即用。也许我安装了错误的版本或什么?
【问题讨论】: