美文网首页
vant中图片查看页预览功能ImagePreview

vant中图片查看页预览功能ImagePreview

作者: jesse28 | 来源:发表于2023-01-15 11:46 被阅读0次
    参考链接:https://www.jb51.net/article/265475.htm
     <!-- 现场照片 -->
            <van-field required name="livePhoto" label="现场照片:">
              <template #input>
                <div class="liveSty">
                  <img v-for="(item,index) in livePhotoList" :src="item" :key="item" @click="getImg(livePhotoList, index)" />
                </div>
              </template>
            </van-field>
    

    这边img标签要写在template里面,这样就可以水平展示


    image.png
       // 现场照片处理--created生命周期调用接口返回图片id
          this.livePhotoList = res.data.livePhoto.split(',').map(item => {
            return `${window.webConfig.api}/oss-api-service/attachment/download/${item}/`
          })
    
      getImg(images, index) {
          ImagePreview({
            images: this.livePhotoList,
            startPosition: index
          })
        },
    

    相关文章

      网友评论

          本文标题:vant中图片查看页预览功能ImagePreview

          本文链接:https://www.haomeiwen.com/subject/yfhacdtx.html