图片预览

This commit is contained in:
yanran200730
2022-06-15 18:05:38 +08:00
parent 25476447a9
commit 76593d3599
2 changed files with 11 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ export default {
onShow() { onShow() {
this.$refs?.TabPage?.show() this.$refs?.TabPage?.show()
this.$nextTick(() => { this.$nextTick(() => {
this.injectJWeixin(['getLocation', 'sendChatMessage', 'shareAppMessage', 'shareWechatMessage']) this.injectJWeixin(['getLocation', 'previewImage'])
}) })
} }
} }

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="photo" v-if="pageShow" @click="isShow = !isShow"> <div class="photo" v-if="pageShow" @click="isShow = !isShow">
<div class="photo-wrapper"> <div class="photo-wrapper">
<image mode="widthFix" :src="img" /> <image mode="widthFix" :src="img" @click="preview(img)" />
</div> </div>
<div class="photo-bottom" :class="[isShow ? 'active' : '']"> <div class="photo-bottom" :class="[isShow ? 'active' : '']">
<div class="top"> <div class="top">
@@ -83,9 +83,15 @@
}, },
preview (url) { preview (url) {
uni.previewImage({ // uni.previewImage({
urls: [url], // urls: [url],
current: url // current: url
// })
if (!this.isShow) return
wx.previewImage({
current: url, // 第一张显示的图片链接
urls: [url] // 需要预加载的图片http链接列表预加载后可以滑动浏览这些图片
}) })
} }
} }