关于swiper.js:swiper720设置autoplay自动播放不生效

新版本设置autoplay怎么都不失效,看了官网的Demos才发现须要在SwiperCore上应用Autoplay组件,包含鼠标滚动这些都须要use对应的组件 <script>import SwiperCore, { Autoplay, FreeMode, Scrollbar, Mousewheel } from "swiper";SwiperCore.use([Autoplay, FreeMode, Scrollbar, Mousewheel]);</script><template> <swiper :direction="'vertical'" :spaceBetween="50" :scrollbar="true" :mousewheel="true" :autoplay="{ delay: 1500, disableOnInteraction: false, }" class="mySwiper" /></template>

December 14, 2021 · 1 min · jiezi

关于swiper.js:swiper实现异形滚动

根本信息官网介绍Swiper is the free and most modern mobile touch slider with hardware accelerated transitions and amazing native behavior. It is intended to be used in mobile websites, mobile web apps, and mobile native/hybrid apps.文档引入: https://swiperjs.com/get-star...API: https://swiperjs.com/api/Demo: https://swiperjs.com/demos/Git: https://github.com/nolimits4w...应用场景-过渡成果轮播图实际指标实现一个异形轮播图。反对手势左右滑动切换核心图。 实现异形滚动的原理核心页(class: swiper-slide-active)scale:1,其余页(class: swiper-slide) scale(0<x<1)来实现核心页在用户视觉核心的成果。scale留白区域通过swiper的配置项( 调整每个swiper) + css款式(整体元素微调) 来打消。 代码参考(局部)index.vue: <div class="gallery-wrapper"> <!-- Slider main container --> <div class="swiper-container"> <!-- Additional required wrapper --> <div class="swiper-wrapper"> <!-- Slides --> <div class="swiper-slide" v-for="(item,index) in images" :key="`${item.src}-index`" > <img v-lazy="item.src" :key="item.src" class="image-content" <v-touch tag="div" @tap="onTap(index)" > <img src="./../../../assets/art-picture/scale-icon.png" alt="放大" class="scale-icon" /> </v-touch> <!-- <div class="swiper-lazy-preloader">loading...</div> --> </div> </div> </div> </div>style.less: ...

August 29, 2021 · 3 min · jiezi

关于swiper.js:Swiper6在Vue中使用滚动翻页小记

1. 首先进入Swiper官方网站咱们关上S6在Vue中的使用手册https://swiperjs.com/vue#swip...2. 而后全页搜寻mouse相干操作 上图示意Swiper供咱们调用的API(module), 值得注意的是标记 ① 处文字: 这示意Swiper6不再同之前一样 在attribute中绑定options, 而是应用module的形式来应用3. 伪代码演示<template> <swiper mousewheel // 这里为定义好的属性( 监听滚轮, 管制swiper-slide), 留神这里须要小写 > <swiper-slide> content </swiper-slide> </swiper></template><script>import "swiper/swiper.min.css";import SwiperCore, { Mousewheel } from "swiper"; // 引入默认抛出的外围模块和所用到按需引入的模块import { Swiper, SwiperSlide } from "swiper/vue"; // swiper componentsSwiperCore.use(Mousewheel); // 注册其按需引入的模块. 这样就能够应用了;export default { name: "SwiperTest", components: { Swiper, SwiperSlide }}</script>4. 总结4.1 文档中寻找适合的模块4.2 引入并注册module4.3 属性援用中留神大小写

July 12, 2021 · 1 min · jiezi

关于swiper.js:swiper和vueawesomeswiper使用配置

最近在应用swiper实现轮播成果:swiper版本不同,应用有所不同。swiper6配置如下:main.js:app.vue:optionsAc: { direction: 'vertical', effect: 'coverflow', slideShadows: false, coverflow: { stretch: -40, depth: 200, modifier: 2, rotate: 0 }, slidesPerView: 1, //一行显示3个 spaceBetween: 0, //距离30 grabCursor: true, centeredSlides: true, speed: 1000, // loop:true,//循环会导致点击切换和显示错位 on: { slideChangeTransitionEnd (swiper) { vm.$nextTick(function(){ this.clickAc=swiper.snapIndex })}}}swiper6以下配置如下:

March 19, 2021 · 1 min · jiezi

关于swiper.js:vueawesomeswiper插件looptrue和手动翻滚冲突

最近在做一个需要是:高低联动,点击下面,上面翻滚到对应图片,翻滚图片,下面对应图片选中。应用过程中发现两个bug:然而在配置属性的时候,发现两个bug。bug1:(滚动监听:slideChangeTransitionEnd,loop:true),界面进来会显示如下:高低联动都会错位显示:bug2:去掉loop属性,疾速翻滚上面图片时,有时触发不了slideChangeTransitionEnd,导致错位显示

March 19, 2021 · 1 min · jiezi

关于swiper.js:vue项目使用swipervueawesomeswiper无法使用coverflow等坑

1. 无奈应用coverflow, fade等各种effect依照vue-awesome-swiper官网文档装置后: npm install swiper vue-awesom-swiper --save发现无奈应用coverflow的3D成果,看了swiper版本是6以上的,vue-awesome-swiper的版本是4以上的。swiper中文文档4-6版本的是有effect的,不晓得为什么用不了。看了vue-awesome-swiper上的issue,把swiper降到4就能用了。 npm install swiper@4.1.5一开始想不到更新的版本居然会不反对3D成果,或者是vue-awesome-swiper的兼容问题,找了半天,终于升高版本解决了这个问题。 2. 引入css门路加dist/同样依照官网文档引入css,然而终端却报错了:找不到swiper/css/swiper.css // import style (>= Swiper 6.x)import 'swiper/swiper-bundle.css'// import style (<= Swiper 5.x)import 'swiper/css/swiper.css'去node_modules外面看了一下,改成import 'swiper/dist/css/swiper.css'就不报错了。不晓得构建的时候会不会有问题。 3. 应用coverflow成果时,想要实现挪动端一屏显示三个,又不心愿是等分的如果是等分的很容易解决,只有设置swiper选项:slidesPerView: 3 然而我想实现如下设计稿: 这时如果同时在css外面设置swipe-slide的宽度,就会有很奇怪的成果,大家能够试一下。最初我通过将slidesPerView:'auto',这样设置后就能够设置css宽度,一屏也能够恰好展现三个了。

October 20, 2020 · 1 min · jiezi

小程序记录

1、swiper 里可以嵌套videovideo上可以加浮层 利用<view> posization:fixed但: iOS端会有bug,因为iOS的原生video组件层级太高,会出现浮层“消失的状况”小程序的解决方案是提供了<cover-view> <cover-image>但是,如果在video上添加了过多的<cover-view> <cover-image> 会导致ios端视频播放的卡顿以及swiper滑动的卡顿以上可以模拟实现一个上下滑动轮播视频的demo 2、在xml中使用for循环,需要有一个卫衣的key来作为标识wx:for="{{videoData}}" wx:key="{{videoData}}但如果希望不同页面点进来初始化的内容是不一样的就不能在page-data中先声明 可以在onLoad 或者 onShow中声明 3、"navigationStyle":"custom”, 可以声明头部的navigation 导航为透明,只保留右上角的关闭小程序按钮但是这个属性在 webview中无效后续也许小程序会放开,暂时关注着

June 25, 2019 · 1 min · jiezi

我的swiper初始化

<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Document</title><link rel="stylesheet" href="./dist/css/swiper.css"></head><body> <div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide"> <img src="./banner1.png" alt=""> </div> <div class="swiper-slide"> <img src="./banner1.png" alt=""> </div> <div class="swiper-slide"> <img src="./banner1.png" alt=""> </div> </div> <!-- 如果需要分页器(下面的小点点) --> <div class="swiper-pagination"></div>   <!-- 如果需要导航按钮 (左右按钮)--> <div class="swiper-button-prev"></div> <div class="swiper-button-next"></div>  </div></body><script src="./jquery-2.0.0.min.js"></script><script src="./dist/js/swiper.js"></script><script> var mySwiper = new Swiper('.swiper-container', { direction: 'horizontal', //轮播方向 autoplay: true, //自动轮播 loop:true, //无限循环 speed: 800, // 如果需要分页器 pagination: { el: '.swiper-pagination', }, // 如果需要前进后退按钮 navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, // 如果需要滚动条 scrollbar: { el: '.swiper-scrollbar', }, autoplayDisableOnInteraction: false, observer: true, //修改swiper自己或子元素时,自动初始化swiper observeParents: true, //修改swiper的父元素时,自动初始化swiper})</script> ...

June 8, 2019 · 1 min · jiezi

Angular项目中使用Swiper和Ueditor

这一阵子开始学习angular,张dalao给我一个阉割了很多功能的初级后台项目作为练手,虽然初级,但是有些东西对于初学者来说真的很难,就比如说现在就要讲的引入Swiper和Ueditor这两个插件。难点在于这两个东西都挺老的了,Swiper还好,而Ueditor已经很久没有更新了,在网上查了很久,磕磕绊绊,终于顺利的把这两个东西引入到了项目里。废话不多说,上图上代码先讲Ueditor吧,下图是引入以后的Ueditor富文本编辑器这个是Ueditor的GitHub地址按照GitHub的教程来先把文件download下来然后在项目里安装npm install ngx-ueditor –save然后在AppModel.ts里面引入下面的代码import { BrowserModule } from ‘@angular/platform-browser’;import { FormsModule } from ‘@angular/forms’;import { UEditorModule } from ’ngx-ueditor’;@NgModule({ imports: [ BrowserModule, FormsModule, UEditorModule.forRoot({ js: [ ./assets/ueditor/ueditor.config.js, ./assets/ueditor/ueditor.all.min.js, ], // 默认前端配置项 options: { UEDITOR_HOME_URL: ‘./assets/ueditor/’ } }) ], declarations: [AppComponent], bootstrap: [AppComponent]})export class AppModule { }可以看到js:[]里面引入了两个js文件,这两个文件就在刚刚下下来的压缩包里路径有点复杂ngx-ueditor-master\src\assets把这个ueditor文件夹整个解压到项目里的assets目录下,这样准备工作就做完了接下来就是在组件里面用了下面的是html代码<ueditor [(ngModel)]=“html” //双向绑定编辑器的内容[config]=“editorConfig” //配置[loadingTip]="‘加载中……’" //加载时的文字(onReady)="_ready($event)" //加载完成时的回调(onDestroy)="_destroy()" //销毁时的回调(ngModelChange)="_change($event)" //内容改变时的回调></ueditor>接下来是ts代码 html = ``; //编辑器内容 editorConfig={ wordCount: true, // 文字计数 initialFrameHeight: 300, // 设置高度 initialFrameWidth: ‘100%’, // 设置宽度 } _ready($event){ } _destroy(){ } _change($event){ }具体的API可以在文档里面的查到,就不多说这样就可以在Angular里面使用Ueditor了下班咯,明天再更新一下Swiper的使用 ...

April 12, 2019 · 1 min · jiezi