当前位置: 首页 > wzjs >正文

华强北ic网站建设互联网销售模式

华强北ic网站建设,互联网销售模式,seo企业优化方案,html 单页网站介绍 SlideTo: 使用swiper时, 可通过slideTo 方法跳转到指定的索引页;一般常用的参数有两个 index----索引speed—速度 分析 在 vue3 中, 实现 swiper 控制器的响应式控制,大概分为以下几步: 创建一个…

介绍

SlideTo: 使用swiper时, 可通过slideTo 方法跳转到指定的索引页;一般常用的参数有两个

  1. index----索引
  2. speed—速度

分析

vue3 中, 实现 swiper 控制器的响应式控制,大概分为以下几步:

  1. 创建一个响应式引用,用于存储Swiper实例
  2. 将创建的实例传递给SwipersetControlledSwiper方法。

代码

这里直接使用上篇文章的代码,具体代码解释可参考上几篇文章;这里只针对轮播图的指定跳转等做解释。

<template><div class="index"><swiper:modules="modules":loop="true":slides-per-view="1":space-between="50":autoplay="true":navigation="navigation":pagination="{ clickable: true }":scrollbar="{ draggable: false }"class="swiperBox"@slideChange="onSlideChange"@swiper="setControlledSwiper":controller="{controlledSwiper }"><swiper-slidev-for="(item,index) in state.swiperList":key="index"><div class="swiper-content"><img :src="item.img" alt="" class="swiper-img"></div></swiper-slide><div class="swiper-button-prev" @click.stop="prevEl()" /><!--左箭头。如果放置在swiper外面,需要自定义样式。--><div class="swiper-button-next" @click.stop="nextEl()" /><!--右箭头。如果放置在swiper外面,需要自定义样式。--><!-- 如果需要滚动条 --><!-- <div class="swiper-scrollbar"></div> --></swiper></div>
</template>
<script setup>import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue';import { Swiper, SwiperSlide } from 'swiper/vue'import 'swiper/css/navigation' // 轮播图两边的左右箭头import { Autoplay, Pagination, Navigation, Scrollbar } from 'swiper/modules'const navigation = ref({nextEl: ".swiper-button-next",prevEl: ".swiper-button-prev",});// 在modules加入要使用的模块const modules = [Autoplay, Pagination, Navigation, Scrollbar]const state = reactive({swiperList:[{id:0,img:'/img1.png'},{id:1,img:'/img2.png'}]})// 核心代码 // 创建响应式实例const controlledSwiper = ref(null);// 将实例传递给方法;const setControlledSwiper = (swiper) => {controlledSwiper.value = swiper;console.log(controlledSwiper.value);};//  例如: 点击上箭头的时候默认跳转到第一页;// 实例存在的时候,调用slideTo方法,传递参数; 默认跳转到第一页,所以索引传递0,const prevEl = (e) => {controlledSwiper.value?.slideTo(0,500);}// 更改当前活动swiperconst onSlideChange = (swiper) => {// swiper是当前轮播的对象,里面可以获取到当前swiper的所有信息,当前索引是activeIndexconsole.log(swiper.activeIndex)}</script>
http://www.dtcms.com/wzjs/231619.html

相关文章:

  • 做真实的自己 视频网站百度实时热搜榜
  • 中国电信黄页app网络seo
  • 网站建设需要多长时间爱站查询工具
  • wordpress 重写 函数seo做的比较牛的公司
  • 做名片赞机器人电脑网站是多少专注于seo顾问
  • 幼儿园主题网络图设计要点天津百度优化
  • 怎样免费做自己的网站广州网站优化步骤
  • 重庆专业的网站建设公司网络销售公司
  • 网页游戏开服表怎么关闭长沙优化排名
  • ui做的好的网站网站排名掉了怎么恢复
  • 网站做等保测评关键词网站查询
  • 网站虚拟主机销售百度竞价软件哪个好
  • 怎么知道网站的空间是谁做的济南优化哪家好
  • 松江区建设和管理委员会网站seo外包
  • 网站找谁做浙江网站建设营销
  • 电影网站如何优化湖北疫情最新消息
  • 罗湖医院网站建设成都seo培训班
  • 做整形网站多少钱如何做好网站的推广工作
  • 企业网页页面欣赏嘉兴seo外包平台
  • 杭州桐庐网站建设长沙自动seo
  • 朝阳制作网站seo网络推广知识
  • 网站建设首页模板谈谈你对网络营销的认识
  • 微信网页游戏大全seo排名优化网站
  • 平安做计划书的网站搜盘网
  • 网站网站建设多少钱九江seo
  • 网站建设 公司 天津软文自动发布软件
  • 新建网站如何做关键词磁力搜索器 磁力猫在线
  • 廊坊做网站的免费十八种禁用网站
  • 源码网站取名微博今日热搜榜
  • 网站锚点怎么做个人如何做百度推广