>  기사  >  웹 프론트엔드  >  vue.swiper란 무엇인가요?

vue.swiper란 무엇인가요?

coldplay.xixi
coldplay.xixi원래의
2020-12-24 10:42:092907검색

vue.swiper는 현재 모바일 웹 페이지에서 터치 콘텐츠를 슬라이딩하기 위해 널리 사용되는 js 플러그인입니다. 순수 JavaScript로 만들어진 슬라이딩 특수 효과 플러그인입니다. 휴대폰, 태블릿과 같은 모바일 단말기를 지향합니다. 터치스크린 초점 맵, 터치스크린 탭 전환, 터치스크린 다중 이미지 전환과 같은 일반적인 효과를 실현할 수 있습니다.

vue.swiper란 무엇인가요?

이 튜토리얼의 운영 환경: Windows 7 시스템, Vue 버전 2.9.6, Dell G3 컴퓨터.

【추천 관련 글: vue.js

Swiper(Swiper master)는 현재 널리 사용되는 모바일 웹페이지 터치 콘텐츠 슬라이딩 js 플러그인으로 순수 JavaScript로 제작된 슬라이딩 특수효과 플러그인입니다. 휴대폰 및 태블릿 및 기타 모바일 단말기의 경우 터치 스크린 초점 이미지, 터치 스크린 탭 전환, 터치 스크린 다중 이미지 전환 등과 같은 일반적인 효과를 실현할 수 있습니다.

swiper는 모바일 및 PC 단말기에서 슬라이딩 작업을 구현하는 데 사용할 수 있는 최초의 타사 라이브러리입니다. 매우 편리합니다(공식 문서 https://www.swiper.com.cn/)

사용 방법 swiper in vue 방법:

먼저 npm

npm i swiper

를 통해 swiper를 소개하세요. swiper를 사용하려는 페이지에 swiper

  <div class="swiper-container">
    <div class="swiper-wrapper">
      <div class="swiper-slide">
        <img src="http://img5.imgtn.bdimg.com/it/u=3920751897,3443157588&fm=26&gp=0.jpg" alt="">
         <img src="http://img5.imgtn.bdimg.com/it/u=3920751897,3443157588&fm=26&gp=0.jpg" alt="">
      </div>
      <div class="swiper-slide">
        <img src="http://img1.imgtn.bdimg.com/it/u=2320813231,2555689438&fm=26&gp=0.jpg" alt="">
           <img src="http://img1.imgtn.bdimg.com/it/u=2320813231,2555689438&fm=26&gp=0.jpg" alt="">
      </div>
      <div class="swiper-slide">
        <img src="http://img1.imgtn.bdimg.com/it/u=3667678122,3437809409&fm=26&gp=0.jpg" alt="">
            <img src="http://img1.imgtn.bdimg.com/it/u=3667678122,3437809409&fm=26&gp=0.jpg" alt="">
      </div>
    </div>
  </div>

를 추가하세요

import Swiper from &#39;swiper&#39;
  import &#39;../../../../node_modules/swiper/js/swiper.js&#39;
  import "../../../../node_modules/swiper/css/swiper.css"
    export default {
            mounted(){
          var mySwiper = new Swiper(&#39;.swiper-container&#39;, { 
         autoplay: {
            delay: 3000,//自动切换时间设置
            stopOnLastSlide: false,//当自动切换到最后一张时是否停止自动切换
            disableOnInteraction: true,//用户触摸时是否停止自动切换
           },
          loop:true
        })
      },
        
    }
Introduce

rrreee관련 무료 학습 권장 사항:

js 비디오 튜토리얼
🎜 🎜

위 내용은 vue.swiper란 무엇인가요?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.