相关疑难解决方法(0)

Vue3 + Vite + Typescript:作用域插槽类型错误

我有一个包含以下 devstack(Vue3、Vite、TypeScript)的项目,但出现以下错误v-slot

Element implicitly has an 'any' type because expression of type '"default"' can't be used to index type '{} | {}'.
  Property 'default' does not exist on type '{} | {}'.ts(7053)
Run Code Online (Sandbox Code Playgroud)
<DataWrapper v-slot="{ values }">
  data: {{ values }}
</DataWrapper>
Run Code Online (Sandbox Code Playgroud)

DataWrapper组件像这样将 props 注入到插槽中

...
<slot :values="data"></slot>
...
Run Code Online (Sandbox Code Playgroud)

它确实编译并按预期工作,但错误仍然存​​在。知道如何解决这个问题吗?太感谢了。

typescript vue.js vuejs3 vite

9
推荐指数
1
解决办法
7469
查看次数

标签 统计

typescript ×1

vite ×1

vue.js ×1

vuejs3 ×1