日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > vue >内容正文

vue

[转]mpvue中的小程序调用系统自带查看图片的功能

發(fā)布時間:2023/12/4 vue 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [转]mpvue中的小程序调用系统自带查看图片的功能 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

mpvue中的小程序調(diào)用系統(tǒng)自帶查看圖片的功能

這里舉個栗子:

<template><div class="keting"><div class="centsimg dja"><swiper:current="curr"display-multiple-items="1"next-margin="0rpx"class="fl prossgg marbtn50"v-if="urls.length > 0"@change='onSlideChangeEnd'><block v-for="(item,ind) in urls" :key="ind+1"><swiper-item class="widssgg fl"><div class="dja" style="height:100%"><img @click="previewImg(ind)" :src="item.img" :style="{'width':width || '750rpx','height':height || '420rpx'}" class="img" ></div><div class="fixbt"><span class="fl">{{curr+1}}/{{urls.length}}</span><span class="fr font28 dja closes"><i v-show="item.shoucan"><img src="/static/images/yishoucan.png" style="width:38rpx;height:38rpx;margin-right:5rpx;"/>收藏圖片</i></span><span class="fr font28 dja"><i v-show="!item.shoucan"><img src="/static/images/weishoucan.png" style="width:38rpx;height:38rpx;margin-right:5rpx;"/>收藏圖片</i></span></div></swiper-item></block></swiper></div></div></template>

js是這樣寫的:

<script>export default {data() {return {curr:0,urls:[{shoucan:false,img:"http://mss.sankuai.com/v1/mss_51a7233366a4427fa6132a6ce72dbe54/newsPicture/05558951-de60-49fb-b674-dd906c8897a6"},{shoucan:true,img:"http://mss.sankuai.com/v1/mss_51a7233366a4427fa6132a6ce72dbe54/coursePicture/0fbcfdf7-0040-4692-8f84-78bb21f3395d",}]};},methods: {onSlideChangeEnd(e){this.curr=e.target.current;},previewImg(ind) {let that = this;that.curr=ind;//wx.previewImage的urls必須是數(shù)組的形式,所以用下面的方法先轉(zhuǎn)換為數(shù)組var jsonText =new Array(that.urls[ind].img);console.log(jsonText);//最主要就是調(diào)用這個wx.previewImage({current: that.urls[ind].img,urls: jsonText});},},};</script>


---------------------
作者:做塊泥
來源:CSDN
原文:https://blog.csdn.net/weixin_37787674/article/details/89674100
版權(quán)聲明:本文為作者原創(chuàng)文章,轉(zhuǎn)載請附上博文鏈接!
內(nèi)容解析By:CSDN,CNBLOG博客文章一鍵轉(zhuǎn)載插件

總結(jié)

以上是生活随笔為你收集整理的[转]mpvue中的小程序调用系统自带查看图片的功能的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。