fix: type errors (#802)

This commit is contained in:
三咲智子 Kevin Deng 2023-01-06 00:48:20 +08:00 committed by GitHub
parent 272fb4a13d
commit acdb94de62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 113 additions and 74 deletions

View file

@ -2,7 +2,7 @@
import { decode } from 'blurhash'
const { blurhash, src, srcset } = defineProps<{
blurhash: string
blurhash?: string | null | undefined
src: string
srcset?: string
}>()
@ -11,8 +11,13 @@ defineOptions({
inheritAttrs: false,
})
const placeholderSrc = ref<string>()
const isLoaded = ref(false)
const placeholderSrc = $computed(() => {
if (!blurhash)
return ''
const pixels = decode(blurhash, 32, 32)
return getDataUrlFromArr(pixels, 32, 32)
})
onMounted(() => {
const img = document.createElement('img')
@ -29,11 +34,6 @@ onMounted(() => {
setTimeout(() => {
isLoaded.value = true
}, 3_000)
if (blurhash) {
const pixels = decode(blurhash, 32, 32)
placeholderSrc.value = getDataUrlFromArr(pixels, 32, 32)
}
})
</script>

View file

@ -5,7 +5,7 @@ import 'vue-advanced-cropper/dist/style.css'
export interface Props {
/** Images to be cropped */
modelValue?: File
modelValue?: File | null
/** Crop frame aspect ratio (width/height), default 1/1 */
stencilAspectRatio?: number
/** The ratio of the longest edge of the cut box to the length of the cut screen, default 0.9, not more than 1 */

View file

@ -3,7 +3,7 @@ import { fileOpen } from 'browser-fs-access'
import type { FileWithHandle } from 'browser-fs-access'
const props = withDefaults(defineProps<{
modelValue?: FileWithHandle
modelValue?: FileWithHandle | null
/** The image src before change */
original?: string
/** Allowed file types */