类型“typeof...”上不存在属性“use”,“typeof”类型上不存在属性“extend”

Ada*_*Ada 4 typescript vue.js

我是第一次使用 TypeScript 构建我的 vue 应用程序,我一直被这个Property 'xxx' does not exist on type 'typeof问题所困扰。我研究过类似的问题,但似乎没有一个工作。我在"vue": "^3.0.0-0""typescript": "~3.9.3"

我安装了 vuetify,所以在我的 vuetify.ts 我有第一个错误(属性 'use' 在类型 'typeof 上不存在)

import Vue from 'vue'
import Vuetify from 'vuetify'

Vue.use(Vuetify)

export default new Vuetify({
})
Run Code Online (Sandbox Code Playgroud)

我在我的 main.ts 中传递它

createApp(App)
  .use(store)
  .use(router)
  .use(vuetify)
  .mount('#app')
Run Code Online (Sandbox Code Playgroud)

然后在我的 App.vue 上,另一个错误在哪里(类型“typeof”上不存在属性“extend”)我有

export default Vue.extend({
  name: 'App',

  components: {
    //
  },

  data: () => ({
    //
  })
})
Run Code Online (Sandbox Code Playgroud)

我也遵循了这里推荐的配置

jer*_*lli 7

Vue 3刚刚被释放。并且没有Vue.use()方法了。现在正确的方法和你一样

createApp(App)
  .use(store)
  .use(router)
  .use(Vuetify) // there
  .mount('#app')
Run Code Online (Sandbox Code Playgroud)

相同,因为Vue.extend()它不再存在。

我不知道 vuetify 现在是否为 vue 3 做好了准备,也许文档还没有更新。

您应该将 Vue 降级到 2.X 版,或者开始学习 Vue 3 并等待所有文档准备就绪