微信小程序uniapp实现左滑删除效果(完整代码)

微信小程序uniapp实现左滑删除效果

实现效果

1,列表中侧滑删除
2,删除不同时存在
3,上下滑动与侧滑删除不影响

在本页面引入组件并使用 (文件在文章的最下方附上)

在需要左滑删除的地方使用

<view v-for="(item, index) in csListArrl" :key="index" :data-index="index">
      <delSlideLeft :item="item" :data_transit="{ index: index, item: item }" @delItem="delItem">
        <view class="editItem">列表展示内容</view>
     </delSlideLeft>
</view>
//点击删除按钮事件
    delItem(e) {
      let that = this;
      that.csListArrl.splice(e.data.index, 1);
    },

引入组件里的两个文件

del_slideLeft.vue

<template>
	<view>
		<view class="box-slideLeft" >
			<view class="touch-item touch-slideLeft " @touchstart="touchS" @touchmove="touchM" @touchend="touchE"  :style="item_show.txtStyle">
				<slot />
			</view>

			<view class="touch-item del-box-touch-slideLeft cf-shuCenter"  @click="delItem(item_show)">
				<view class="iconfont icon-shanchu"></view>
			</view>

		</view>
	</view>
</template>

<script>

	export default {
		components: {

		},
		props: {

			data_transit: {
				type: Object,
				default () {
					return {}
				}
			},
			//可不传参
			item: {
				type: Object,
				default () {
					return {}
				}
			},
		},
		computed: {

		},

		data() {
			return {

				item_show : {},
				delBtnWidth: 60, //删除按钮宽度单位(rpx)
				startX: '',
			};
		},
		created:function(){
			//专门处理检查对象中,某字段是否存在的,如果存在返回 true 不存在返回 false
			let that = this ;
			let item = that.item ;
			if(!item.hasOwnProperty("txtStyle")){
				this.$set(this.item,'txtStyle','');//不需要初始化了
			}
			this.item_show = this.item ;
		},
		watch: {
			item(e){
				this.item_show = e ;
			},
		},
		methods: {
			//点击删除按钮事件
			delItem: function(e) {
				let that = this;
				let data ={
					item : e ,
					data : that.data_transit ,
				};
				this.$emit('delItem', data);
			},
			touchS: function(e) {
				let that = this;

				if (e.touches.length == 1) {
					//设置触摸起始点水平方向位置
					this.startX = e.touches[0].clientX

				}
			},
			touchM: function(e) {
				let that = this;

				if (e.touches.length == 1) {
					//手指移动时水平方向位置
					var moveX = e.touches[0].clientX;
					//手指起始点位置与移动期间的差值
					var disX = this.startX - moveX;
					var delBtnWidth = this.delBtnWidth;
					var txtStyle = "";
					if (disX == 0 || disX < 0) { //如果移动距离小于等于0,说明向右滑动,文本层位置不变
						txtStyle = "left:0px";
					} else if (disX > 0) { //移动距离大于0,文本层left值等于手指移动距离
						txtStyle = "left:-" + disX + "px";
						if (disX >= delBtnWidth) {
							//控制手指移动距离最大值为删除按钮的宽度
							txtStyle = "left:-" + delBtnWidth + "px";
						}
					}
					//获取手指触摸的是哪一项

					that.item_show.txtStyle = txtStyle;

				}
			},
			touchE: function(e) {
				let that = this;
				if (e.changedTouches.length == 1) {
					//手指移动结束后水平位置
					var endX = e.changedTouches[0].clientX;
					//触摸开始与结束,手指移动的距离
					var disX = this.startX - endX;
					var delBtnWidth = this.delBtnWidth;
					//如果距离小于删除按钮的1/2,不显示删除按钮
					var txtStyle = disX > delBtnWidth / 2 ? "left:-" + delBtnWidth + "px" : "left:0px";
					//获取手指触摸的是哪一项
					that.item_show.txtStyle = txtStyle;

				}
			},

		}

	}
</script>

<style lang="scss">
	@import './iconfont.css';//便于有删除图标

	.box-slideLeft {
		view {
			box-sizing: border-box;
		}
		position: relative;
		overflow: hidden;

		.touch-item {
			position: absolute;
			top: 0;
			padding: 10px 10px 10px;
			background-color: #FFFFFF;
			// border-radius: 10px;
			overflow: hidden;
		}

		.touch-slideLeft {
			position: relative;
			width: 100%;
			z-index: 5;
			transition: left 0.2s ease-in-out;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		.del-box-touch-slideLeft {
			right: 0;
			float: left;
			width: 70px;
			height: 100%;
			line-height: 101px;
			background-color: #EA5863;
			border-radius: 0 10px 10px 0;
			color: #fff;
			font-size: 18px;
			font-weight: lighter;
			text-align: center;
		}
		.icon-shanchu{
			font-size: 44upx;
		}

		.cf-shuCenter{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

		}
	}

</style>

iconfont.css

@font-face {font-family: "iconfont";
  src: url('//at.alicdn.com/t/font_1948714_o615zwc843k.eot?t=1616746789802'); /* IE9 */
  src: url('//at.alicdn.com/t/font_1948714_o615zwc843k.eot?t=1616746789802#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAB40AAsAAAAANxgAAB3kAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCLJArSEMEZATYCJAOBcAt6AAQgBYRtB4UzG14tZQRsHAAEyfdM9v/fEqgcrkM6HA8gHK6SOaUSdMUMyyLDsujiBjvfkDGMlRJ3/BQ5Sp/ZHdJL+kgPk/C1IkdeFXL/uVfm55a9hfaV0fT+7Ix4s68BRhtKSQS/X5v3TxUTyWRapDRaI8Y9DmjOmrXIRqyEkISwSTBNQkupELSQJoiVGhZMQs0IYqUC16dA24NUjLZ3qTnVE3r39O6oI+dw2vN6iNTtsyIVViC0vJLMYLArz/97u2/7Z0wDndgMAgwjjoKAk+Z7N7Zj5h3le4QZYEVeEEYBZvOz/W6/tx2hTTorYqGX07JL/vuKPgUJEPsq+uF3PI3+yPJKWp+867bXeBgOoR3ABLDMxka92u3Oq/NNWq2WBfF3ywmXYOrrBLghHgBLq73GATww6yM4PiaD8X8rL+DAEz5vsQIpLaQE682fqZb2hukEK2YPbg8IEN+PgJ+fq7TJAXKu9MrCkJAnTI38P5Pd5CeZ7f7J0W+2vZnlzBQmi8kiqQJr1FVAyWJymDnGAoGrUa2rbY2rkbrQT1/G0TUmfvEo1K3qz9jsfbhqdLDDYoj2YfT0/z44BehSuFTm2pgODLjbaAUoG4vzgGEz4IK5BaOAxtltAXKEwGht6xvEL/n9yw93GAAVosPtkL6f2ALQk/apUsZqSe1IXXwMm92BGnCJOqgebkm5oV7kkmgk7/N5pS/gK/oQaB9A0ZFkFHz5CxEqQjQsJWuLvfZTtenR5zC7057+MPHj9C7rsz0y6fc271PjIA4eX8/mymeyblMZm+70SW/fzCLuzhvXl6UiVZMtm1qWVXe05n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GezZxaR3iWkmADg66smIPi+CSiu6wTjTfxDcJj4VyCI/VdozMylQMqMKCKLZ9CKHsCOUJnyaNAx+dw6TmjdDxAk2R7lr0b7Av2ATGZezK4PboCgjyNk2IXFOHrje27MWguAlNi0PdfgxiLyQPsynfpdaOG4OZuI1gPWaF6zYpSOt0YOI/7ZRxPXb/8BCERi9YIOT7f+AvQG+PKNucJMgt9oJNVhXtyDnWBhRMwzuHmPNYw1YiDdTWb+X3FoVgPOqBBDWK0XUzSQl9WK9ONNF9Wg8XV62/VsBI6ERmcwWb9h/z5tDpfHlxVV0w3Tsh3X84MwipM0y4uyqpu264dxmpd124/zup/3+w00RhwiKtM216doiQ76vkTLHVraCjsP5XWILEfIl4u5DmKpxCWxzfUQ4RRsmCwAhUp4oTypPgRXD6I0yyAsM5glF+Wq4R6UhYXlpbg421qULlhStro5mA1PkSnoPaDFfTViA5dHljD3iz2hfg42fyotO6F8xGixb5dyEaLgc9ZtVGPuJHJCAl/OPaaUdUhh64deHxW0wUMJuM8CTaKsmiKkWB/V+4ZPc1D0IW6BHmzVXOIB1NpnrmocxJIeIyqsEUn9wdQBJVjUCaHsrEtbVXdcN4Uo7GUvIWwUOtFVCjjzuiod8vg9bdJwY+lRehJWheW+c5wSuBHTSpd3leUjrTCJoW4SbiFPSKBexcP9KDr2xkETeVZPxPlM6RMe4ZjmV6V12+s9VzCf+CH3QhVSuIrcgEbaUCQDSuEqUVzIiTMAAA==') format('woff2'),
  url('//at.alicdn.com/t/font_1948714_o615zwc843k.woff?t=1616746789802') format('woff'),
  url('//at.alicdn.com/t/font_1948714_o615zwc843k.ttf?t=1616746789802') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
  url('//at.alicdn.com/t/font_1948714_o615zwc843k.svg?t=1616746789802#iconfont') format('svg'); /* iOS 4.1- */
}

.iconfont {
  font-family: "iconfont" !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-tishi:before {
  content: "\e61b";
}

.icon-tishi1:before {
  content: "\e65e";
}

.icon-zhanshi:before {
  content: "\e6b3";
}

.icon-biaoqiankuozhan_shouye-321:before {
  content: "\ebb2";
}

.icon-guanbi3:before {
  content: "\e606";
}

.icon-guanbi1:before {
  content: "\e61a";
}

.icon-shezhi1:before {
  content: "\e617";
}

.icon-gengduo2:before {
  content: "\e736";
}

.icon-guanbi:before {
  content: "\e613";
}

.icon-xiaoxi1:before {
  content: "\e616";
}

.icon-sousuo1:before {
  content: "\e66d";
}

.icon-shanchu:before {
  content: "\e615";
}

.icon-more:before {
  content: "\e60a";
}

.icon-shang3:before {
  content: "\e689";
}

.icon-xia:before {
  content: "\e65b";
}

.icon-kaiguan3:before {
  content: "\e6da";
}

.icon-kaiguan4:before {
  content: "\e6db";
}

.icon-xuanzhong:before {
  content: "\e607";
}

.icon-weixuan:before {
  content: "\e65d";
}

.icon-time:before {
  content: "\e619";
}

.icon-you:before {
  content: "\e600";
}

.icon-shuazi:before {
  content: "\e62a";
}

.icon-shuazi1:before {
  content: "\e610";
}

.icon-baocun-tianchong:before {
  content: "\e82b";
}

.icon-chehui:before {
  content: "\e66b";
}

.icon-bianji-cuxiantiao-fill:before {
  content: "\e69e";
}

.icon-qingkong:before {
  content: "\e629";
}

.icon-yanse:before {
  content: "\e886";
}

.icon-beiwanglushili:before {
  content: "\e612";
}

.icon-shijian:before {
  content: "\e631";
}

.icon-icon-eye-open:before {
  content: "\e60c";
}

.icon-icon-eye-close:before {
  content: "\e60f";
}

.icon-icon-1:before {
  content: "\e6e0";
}

.icon-jisuan:before {
  content: "\e643";
}

.icon-tongji1:before {
  content: "\e61d";
}

.icon-shezhi:before {
  content: "\e654";
}

.icon-xiugai:before {
  content: "\e698";
}

.icon-liebiao:before {
  content: "\e611";
}

.icon-add:before {
  content: "\e604";
}

.icon-shenghuofuwu:before {
  content: "\e681";
}

.icon-jingqu:before {
  content: "\e61e";
}

.icon-dianhua:before {
  content: "\e76a";
}

.icon-xiaoxi:before {
  content: "\e79c";
}

.icon-zhoumomanmanzuo:before {
  content: "\e7d5";
}

.icon-sousuo:before {
  content: "\e62c";
}

.icon-collection-b:before {
  content: "\e60d";
}

.icon-daohangdizhi:before {
  content: "\e65f";
}

.icon-like-line:before {
  content: "\e634";
}

.icon-like-s:before {
  content: "\e635";
}

.icon-tubiaozhizuo-:before {
  content: "\e605";
}

.icon-shoucang:before {
  content: "\e6a7";
}

.icon-ziyuan1:before {
  content: "\e618";
}

.icon-back:before {
  content: "\e602";
}

.icon-wode1:before {
  content: "\e658";
}

.icon-fs-funding:before {
  content: "\e60e";
}

.icon-home:before {
  content: "\e63f";
}

.icon-gupiao:before {
  content: "\e614";
}

.icon-xiangzuo:before {
  content: "\e6b0";
}

.icon-xiangyou:before {
  content: "\e65a";
}

到此这篇关于微信小程序uniapp实现左滑删除效果的文章就介绍到这了,更多相关微信小程序uniapp左滑删除内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

(0)

相关推荐

  • uniapp在微信小程序中使用ECharts的方法

    今天使用uniapp集成Echarts,实现地图图表的展示 可以参照mpvue-echarts 参照:https://github.com/F-loat/mpvue-echarts https://ask.dcloud.net.cn/article/36288 进行改进 网上有很多教程,但都说的不是很明白,下面直接上步骤 1.npm install echarts mpvue-echarts 执行该命令后,会在node_modules下生成mpvue-echarts.echarts,然后把mpv

  • uniapp微信小程序:key失效的解决方法

    uniapp 代码 <template> <view> <image v-for="(item, i) in fileList" :key="item[urlKey]" :src="item[urlKey]"></image> </view> </template> <script> export default { props: { urlKey: {defau

  • uniapp微信小程序实现一个页面多个倒计时

    本文实例为大家分享了uniapp实现一个页面多个倒计时的具体代码,供大家参考,具体内容如下 设计图(需求) 在这里插入图片描述 结构 <view class="group-list" v-for="item in message" :key="item.productId"> <view class="group-img" @click="navTo"> <image :src

  • uniapp,微信小程序中使用 MQTT的问题

    最近在uniapp打包成微信小程序的项目中第一次用到了MQTT.使用比较简单,但是还是遇到了一些问题.在此记录一下. 官方文档:MQTT Github 官方MQTT测试工具:MQTTX.测试工具使用说明 MQTT的js文件:mqtt.min.js 先上一点注意事项: (1)MQTT.js 一个 MQTT 协议的客户端库,用 JavaScript 编写,可用于 Node.js 和浏览器.在 Node.js 端可以通过全局安装使用命令行连接,同时还支持 MQTT ,MQTT TLS 证书连接:值得一

  • 微信小程序uniapp实现左滑删除效果(完整代码)

    微信小程序uniapp实现左滑删除效果 实现效果 1,列表中侧滑删除 2,删除不同时存在 3,上下滑动与侧滑删除不影响 在本页面引入组件并使用 (文件在文章的最下方附上) 在需要左滑删除的地方使用 <view v-for="(item, index) in csListArrl" :key="index" :data-index="index"> <delSlideLeft :item="item" :dat

  • 微信小程序基于movable-view实现滑动删除效果

    基于movable-view实现的一种较为完美的滑动删除效果 前言:用了很多去实现滑动删除的效果,都不太尽如人意,最后用小程序官方专用滑动组件来实现,但是这个组件有一点坑,咱们慢慢道来 1.wxml布局 <view class="list"> <view class="row" wx:for="{{list}}" wx:key="id"> <movable-area class="lis

  • vue项目实现左滑删除功能(完整代码)

    实现效果 代码如下 html <template> <div> <div class="biggestBox"> <ul> <!-- data-type=0 隐藏删除按钮 data-type=1 显示删除按钮 --> <li class="li_vessel" v-for="(item,index) in lists " data-type="0" :key=&

  • 微信小程序左滑删除效果的实现代码

    今天我们说下微信小程序左滑删除效果的实现,现在市场上很多APP都在使用这个效果,一个listView页面,向左滑动一条item时,右侧会出现一个删除或者其他的选项,用户体验非常好,操作起来十分方便,今天我们使用微信小程序来实现这个效果....... 先看效果 要实现的效果: 1,当向左滑动时,item跟随手指像左移动,同时右侧出现两个可点击的按钮 2,当滑动距离大于按钮宽度一半松开手指时,item自动滑动到左侧显示出按钮,小于一半时item自动回到原来的位置,隐藏按钮. 思路: 1,首先页面每个

  • 微信小程序实现左滑删除效果

    微信小程序实现左滑删除效果的具体代码,供大家参考,具体内容如下 .wxml <scroll-view scroll-y="{{isScroll}}" style='width:{{windowWidth}}px;height:{{windowHeight}}px'> <block wx:key="item" wx:for="{{data}}"> <view data-index='{{index}}' class=&

  • 微信小程序实现列表项左滑删除效果

    本文实例为大家分享了微信小程序实现列表项左滑删除效果的具体代码,供大家参考,具体内容如下 效果 图片 WXML <view class="container"> <!-- 收货地址 --> <view class="address"> <view class="left"> <view class="icon"> <image src="../../i

  • 小程序实现左滑删除效果

    本文实例为大家分享了小程序实现左滑删除效果的具体代码,供大家参考,具体内容如下 1.movable-area基本概念 实现思路: 大家仔细去看看官网的文档后再来看我写的这篇文章可能会更好理解. (1)movable-area这个就是定义了一个移动的区域,跟普通的<view></view>的含义是一样的,不同在于,接着往下看: 注意:movable-area 必须设置width和height属性,不设置默认为10px (2)movable-view这个就是一个可移动的视图容器,可以在

  • mpvue小程序仿qq左滑置顶删除组件

    背景: 前几天,公司的一个小程序项目开发的时候,遇到了一点点问题.设计师这狗币要让我在小程序上实现类似QQ左滑置顶删除的操作,心里mmp,我就是一个刚来公司三天的小小前端实习生而已,我想学习....当然刚刚来就被公司委以重任,也能看出本人技术过人,尤其是作为一个大二刚刚结束的学生来说.废话不多说,对于这个功能,第一反应就是百度,不百度不得了,一百度吓一跳.前辈们也来都做过."那我不是直接照搬就行,开心".开开心心的用mpvue上手之后,心里mmp,mpvue的坑这么多....还不如自己

  • 微信小程序项目总结之点赞 删除列表 分享功能

    小程序点赞功能 思路:在后台没有给你接口自己模拟数据 data:{ likes:{ iszan:false, num:0 } } 1.遍历评论列表 判断点击的id 2.如果id相同 判断是否点赞过 如果为true -1 如果为false +1 3.更新数据 bindlike:function(e){ var newData = this.data.release.map(function(item){ if (item.id == e.currentTarget.dataset.id){ con

  • 小程序原生实现左滑抽屉菜单

    目录 WXS 响应事件 方案A 页面结构和样式 WXS 事件回调函数 WXS 脚本 遮罩层 方案B 为什么要使用 WXS 结语 & 参考资料 参考资料: 在移动端,侧滑菜单是一个很常用的组件(通常称作 Drawer,抽屉).因为现在手机屏幕太大,点击角落的菜单按钮明显不如在屏幕中间滑动方便. 相比其他平台,小程序的组件库支持明显还不够完善,各个框架也还不太成熟.由于之前使用框架的过程中被各种神秘bug搞的头秃,还是用回了原生环境. 最近研究了一下如何在原生框架中实现滑动抽屉菜单效果,本来以为很麻

随机推荐