32 lines
660 B
JavaScript
32 lines
660 B
JavaScript
/**
|
||
* @name: useImage
|
||
* @author: kahu4
|
||
* @date: 2023-11-07 16:34
|
||
* @description:useImage
|
||
* @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
|
||
}
|
||
}
|