主要.ts
import { createVuetify } from 'vuetify';
import * as components from 'vuetify/components';
import * as directives from 'vuetify/directives';
const vuetify = createVuetify({
components,
directives,
});
app.use(vuetify);
app.mount('#app');
按钮.vue
<v-btn rounded color="#000" variant="outlined" @click="()=>{}">Download</v-btn>
我在运行名为
npm run build
的
Argument of type '{ rounded: boolean; color: string; variant: string; onClick: any; }' is not assignable to parameter of type 'never'.
时收到错误
我们如何解决这个问题?
我认为您错过了将
vuetify
类型添加到 tsconfig.json
:
{
"compilerOptions": {
"types": [
"vite/client",
"vuetify"
],
"target": "esnext",
"module": "esnext",
"paths": {
"@/*": [
"./src/*"
]
},
},
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
}
]
}