移動端vant ui中ImagePreview 組件的使用 (拒絕抄襲官網)


1.如果是全局注冊vant的情況下,只需在需要使用的組件里面引入即可

 

 2.給圖片添加click事件 (一定使用一個元素包裹div,會有好處的!!)

 <header>
        <div class="img_box" v-for='(item2,index) of images' :key='index'>
            <img :src="item2" alt="" @click="getImg(item2,index)">
        </div>
      </header>

 

 3.

 

 4.點擊事件

   getImg(images,index){
        ImagePreview({
            images: this.images,
            showIndex:true,
            loop:false, //是否循環播放
            startPosition:index
        })
    }
  }

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM