更新记录
1.0.0 下载此版本
首次发布
平台兼容性
uni-app(4.52)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | - | - | - | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
√ | - | - | - | - | - | - | - | - | - | - |
jim-js-slider
jim-js-slider小工具,适用于为控件添加左滑、右滑监听事件,在事件处理函数中处理业务,比如切换控件,弹出工具框等。
使用方式:
<template>
<view @touchstart="(event) => sliderUtils.bindTouchStart(event, item)"
@touchmove="sliderUtils.bindTouchMove"
@touchend="sliderUtils.bindTouchEnd">
<view>
</template>
<script>
/**
* 引入模块
*/
import { SliderUtils } from '@/uni_modules/jim-js-slider/js_sdk/slider-utils.js';
/**
* sliderUtils实例
*/
const sliderUtils = new SliderUtils();
export default{
onLoad() {
/**
* 为左滑事件绑定处理函数
*/
sliderUtils.onOpen((item) => {
console.log('收到左滑事件');
});
/**
* 为右滑事件绑定处理函数
*/
sliderUtils.onClose((item) => {
console.log('收到右滑事件');
});
}
}
</script>
属性说明:
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
bindTouchStart | Function | - | 绑定上控件的@touchstart事件上面 |
bindTouchMove | Function | - | 绑定上控件的@touchmove事件上面() |
bindTouchEnd | Function | - | 绑定上控件的@touchend事件上面() |
onOpen | Function | - | 设置左滑打开回调 |
onClose | Function | - | 设置右滑关闭回调 |
setDeltaX | Function | - | 设置滑动触发阈值,默认为50,单位为像素 |