如何解决二次封装antdv中select组件的插槽类型错误?-灵析社区

光光哥乌昂

`#[item]="data"`的`item`会有如下报错,大佬指点一下这里该怎么写? > Element implicitly has an 'any' type because expression of type 'string' > can't be used to index type 'Readonly any; itemIcon: any; removeIcon: any; clearIcon: any; dropdownRender: any; > option: any; placeholder: any; tagRender: any; maxTagPlaceholder: any; > optionLabel: any; default: any; }>'. ts(7053)

阅读量:217

点赞量:0

问AI
可以考虑使用 defineSlot 定义插槽 "https://cn.vuejs.org/api/sfc-script-setup.html#defineslots" (https://link.segmentfault.com/?enc=VHxoJp1E6%2FHR%2FMOH5UNv8w%3D%3D.99yR4BMfHG9IAq27KTYFYy3ETPIVKUss4tzrI3xDr3IomfoDpQ3SDQ6qJeB%2BjKF3Z2iDMKspPYMVbMuLn2kF9A%3D%3D)