Files
yshop-pro-uniapp/hooks/useImage.js
2023-11-14 17:21:03 +08:00

32 lines
660 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @name: useImage
* @author: kahu4
* @date: 2023-11-07 16:34
* @descriptionuseImage
* @update: 2023-11-07 16:34
* */
export function useImage() {
/**
* options?: PreviewImageOptions
* @param options {PreviewImageOptions}
* @returns {Promise<unknown>}
*/
function preview(options) {
return new Promise((resolve, reject) => {
uni.previewImage({
indicator: 'default',
loop: true,
...options,
success: () => resolve(true),
fail: (err) => reject(err)
})
})
}
return {
preview
}
}