# swiper (樱花视频免费观看)

基础库 1.0.0 开始支持,低版本需做兼容处理

微信 Windows 版:支持

微信 Mac 版:支持

微信 鸿蒙 OS 版:支持

渲染框架支持情况:Skyline (使用最新 Nightly 工具调试) 樱花视频在线. WebView.

# 功能描述

滑块视图容器,其中只可放置swiper-item组件 樱花视频高清,否则会导致未定义的行为。

  1. 使用 worklet 函数需要开启开发者工具 "将 JS 编译成 ES5" 或 "编译 worklet 函数" 选项。

# 通用属性

属性类型默认值必填说明最低版本
indicator-dotsbooleanfalse是否显示面板指示点1.0.0
indicator-colorcolorrgba(0, 0, 0, .3)指示点颜色1.1.0
indicator-active-colorcolor#000000当前选中的指示点颜色1.1.0
autoplaybooleanfalse是否自动切换1.0.0
currentnumber0当前所在滑块的 index1.0.0
intervalnumber5000自动切换时间间隔1.0.0
durationnumber500滑动动画时长1.0.0
circularbooleanfalse是否采用衔接滑动1.0.0
verticalbooleanfalse滑动方向是否为纵向1.0.0
display-multiple-itemsnumber1同时显示的滑块数量1.9.0
previous-marginstring"0px"前边距,可用于露出前一项的一小部分,接受 px 和 rpx 值1.9.0
next-marginstring"0px"后边距,可用于露出后一项的一小部分,接受 px 和 rpx 值。skyline 于 3.5.1 版本支持1.9.0
easing-functionstring"default"指定 swiper 切换缓动动画类型2.6.5
合法值说明
default默认缓动函数
linear线性动画
easeInCubic缓入动画
easeOutCubic缓出动画
easeInOutCubic缓入缓出动画
directionstring"all"指定 swiper 滑动方向3.8.10
合法值说明
all默认
positive如 vertical 为 true 时,允许用户下滑(swiper 内容向上滚动),为 false 时,允许用户右滑(swiper 内容向左滚动)
negative如 vertical 为 true 时,允许用户上滑(swiper 内容向下滚动),为 false 时,允许用户左滑(swiper 内容向右滚动)
bindchangeeventhandlecurrent 改变时会触发 change 事件,event.detail = {current, source}1.0.0
bindtransitioneventhandleswiper-item 的位置发生改变时会触发 transition 事件,event.detail = {dx: dx, dy: dy}。Skyline 仅支持非 worklet 的组件方法作为回调。2.4.3
bindanimationfinisheventhandle动画结束时会触发 animationfinish 事件,event.detail 同 bindchange。Skyline 仅支持非 worklet 的组件方法作为回调。1.9.0

# Skyline 特有属性

属性类型默认值必填说明最低版本
layout-typestringnormal渲染模式3.2.0
合法值说明
normal默认方式
stackLeft左向堆叠
stackRight右向堆叠
tinder滑动卡片
transformer过渡动画
transformer-typestringscaleAndFadelayout-type 为 transformer 时指定动画类型3.2.0
合法值说明
scaleAndFade
accordion
threeD
zoomIn
zoomOut
deepthPage
indicator-typestringnormal指示点动画类型3.2.0
合法值说明
normal
worm
wormThin
wormUnderground
wormThinUnderground
expand
jump
jumpWithOffset
scroll
scrollFixedCenter
slide
slideUnderground
scale
swap
swapYRotation
color
indicator-marginnumber10指示点四周边距3.2.0
indicator-spacingnumber4指示点间距3.2.0
indicator-radiusnumber4指示点圆角大小3.2.0
indicator-widthnumber8指示点宽度3.2.0
indicator-heightnumber8指示点高度3.2.0
indicator-alignmentArray./stringauto指示点的相对位置3.2.0
indicator-offsetArray.[0, 0]指示点位置的偏移量3.2.0
scroll-with-animationbooleantrue改变 current 时使用动画过渡2.29.0
cache-extentnumber0缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小)2.29.0
worklet:onscrollstartworklet滑动开始时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy}
worklet:onscrollupdateworklet滑动位置更新时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy}
worklet:onscrollendworklet滑动结束时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy}

# WebView 特有属性

属性类型默认值必填说明最低版本
snap-to-edgebooleanfalse当 swiper-item 的个数大于等于 2,关闭 circular 并且开启 previous-margin 或 next-margin 的时候,可以指定这个边距是否应用到第一个、最后一个元素2.12.1

樱花视频网站 - # 注意事项

  1. layout-typestackLeft stackRighttinder 时仅支持 indicator-type=normal
  2. indicator-typescrollFixedCenter swap swapYRotation 无法在循环模式 circular 下使用
  3. indicator-alignment 可指定为关键词 auto 或 长度为 2 的数组。
    • 横向滑动时 auto 相当于 bottomCenter [0, 1]
    • 纵向滑动时,auto 相当于 centerRight [1, 0]
    • 传入数组时,表示 x/y 轴的相对位置,取值范围 [-1, 1],底边中点为 [0, 1]
  4. indicator-offset 是长度为 2 的数组,表示指示点在 x/y 轴上的偏移量,单位 px。
  5. skyline 的 previous-margindisplay-multiple-itemsvertical 属性与 webview 表现略有不同,当skyline 使用 next-margin 属性且其值大于 0 时,会将前述三个属性对齐 webview 实现。

# 渲染模式效果演示

# 指示器效果演示 (樱花视频免费观看)

# Swiper 增强特性示例代码

在开发者工具中预览效果

# 日事件 返回值 (樱花视频)

从 1 樱花视频免费观看,4,0 开始,change事件增加 source字段,表示导致变更的原因,可能值如下:.

  1. autoplay 自动播放导致swiper变化;
  2. touch 用户划动引起swiper变化;
  3. 其它原因将用空字符串表示。

# Bug & Tip (樱花视频网站)

  1. tip: 如果在 bindchange 的事件回调函数中使用 setData 改变 current 值,则有可能导致 setData 被不停地调用,因而通常情况下请在改变 current 值前检测 source 字段来判断是否是由于用户触摸引起。
  2. tip: 在 mac 小程序上,若当前组件所在的页面或全局开启了 enablePassiveEvent 配置项,该内置组件可能会出现非预期表现(详情参考 enablePassiveEvent 文档

# 示例代码

在开发者工具中预览效果