@kwai-explore/picture.vue
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "@kwai-explore/picture.vue", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -40,12 +40,23 @@ # @kwai-explore/picture.vue | ||
添加类型: | ||
根据上面的配置添加类型: | ||
`vite-env.d.ts` | ||
这里的文档需要换一下:理论上应该标记的是自己生成的类型 | ||
```ts | ||
declare module '*?preset=modern' { | ||
const src: import('vue').ImgHTMLAttributes[]; | ||
// vue2.7 换成: | ||
// const src: import('vue/types/jsx').ImgHTMLAttributes[]; | ||
export default src; | ||
type SourceOption = { | ||
type: string; | ||
srcset: string; | ||
}; | ||
type ImgOption = { | ||
src: string; | ||
// 这下面的属性需要与 vite config 里的 formatPreset 配置同步修改 | ||
loading: 'lazy'; | ||
}; | ||
type PictureOption = [...SourceOption[], ImgOption]; | ||
const src: PictureOption; | ||
export default src; | ||
} | ||
@@ -52,0 +63,0 @@ ``` |
Sorry, the diff of this file is not supported yet
8251
126