2025/2/8第一次更新

This commit is contained in:
爱吃咸鱼小猫咪
2025-02-08 18:50:38 +08:00
commit d7af560866
26519 changed files with 5046029 additions and 0 deletions
@@ -0,0 +1 @@
export * from './use-photo-album'
@@ -0,0 +1,31 @@
import { computed } from 'vue'
import {} from '../../../../utils'
import type { SetupContext } from 'vue'
import type { PhotoAlbumEmit, PhotoAlbumProps } from '../photo-album'
export const usePhotoAlbum = (
props: PhotoAlbumProps,
emits: SetupContext<PhotoAlbumEmit>['emit']
) => {
// 相册图片数据
const imageData = computed<string[]>(() => {
const maxLength = Math.min(props.data.length, props.max)
return props.data.slice(0, maxLength)
})
// 图片点击事件
const imageClickEvent = (index: number) => {
emits('click', index)
if (!props.preview) return
uni.previewImage({
urls: imageData.value,
current: index,
})
}
return {
imageData,
imageClickEvent,
}
}