您现在的位置:首页 >> 前端 >> 内容

vue图片左右滑动及手势缩放功能代码实现教程

时间:2018/5/9 16:33:21 点击:

  核心提示:引入vue-awesome-swiperimport swiper/dist/css/swiper.css;import { swiper, swiperSlide } from vue-awesom...

引入vue-awesome-swiper

import 'swiper/dist/css/swiper.css';
import { swiper, swiperSlide } from 'vue-awesome-swiper';
components: {
  swiper,
  swiperSlide,
},
data() {
  return {
    swiperOption: {
      width: window.innerWidth,
      zoom : true,
      initialSlide: 0,
    },
  };
},
<swiper :options="swiperOption" ref="imgOverview" style="height: 100%;">
  <swiper-slide v-for="(img, index) in previewImg">
    <p class="swiper-zoom-container">
      <img :src="img" alt="">
    </p>
  </swiper-slide>
</swiper>

Tags:VU UE E图 图片 
作者:网络 来源:ttn456456的