换了 Vue-Official 的编辑器扩展后就不生效,如果使用之前的 volar 是可以生效的。
import { Component, SwiperProps, SwiperItemProps, SwiperItem } from '@uni-helper/uni-app-types'
declare global {
namespace JSX {
interface IntrinsicElements {
swiper: SwiperProps
// swiperItem: SwiperItemProps
swiperItem: SwiperItem
swiper20: SwiperItemProps
}
}
}
declare module '@vue/runtime-core' {
interface GlobalComponents {
swiper: SwiperProps
swiperItem: SwiperItemProps
swiper20: SwiperItemProps
}
}
declare module 'vue3/jsx-runtime' {
namespace JSX {
interface IntrinsicElements {
swiper: SwiperProps
swiperItem: SwiperItemProps
swiper20: SwiperItemProps
}
}
}
试了一下上面的方式都没用生效,其中 props 结尾的类型是组件的属性类型。SwiperItem 等于 _SwiperItem, type _SwiperItem = _Component<_SwiperItemProps>
https://uni-typed.netlify.app/guide/uni-app-types.html#%E9%85...