微信小程序之一个超级简单的基础滑动实现~
<template>
<view class="body">
<view>当前显示页数:{
{ pageNum }}</view>
<view
class="swip"
@touchstart="touchstart"
@touchmove="touchMove"
@touchend="touchEnd"
>
滑动内容
</view>
</view>
</template>
<script>
import { AtFlex, AtFlexItem, AtInput } from "taro-ui-vue3";
import "./introduce.scss";
export default {
data() {
return {
pageNum: 0,
moveFlag: true, // 判断执行滑动操作
touchDot: null,
touchMove: null,
animation1: null,
animation2: null,
};
},
created() {},
methods: {
touchstart(e) {
console.log(e);
this.touchDot = e.touches[0].pageX;
this.moveFlag = true;
},
touchMove(e) {
this.touchMove = e.touches[0].pageX;