vue移动端模仿qq左右滑动删除
来源:互联网 发布:网络机顶盒一般多少钱 编辑:程序博客网 时间:2024/06/06 19:53
移动端模仿qq左右滑动删除
1、页码效果图
2、左滑动
3、点击删除就可以删除该条信息了或者右滑动隐藏删除
4、源码:
<template> <div class="tab_manage_wrap bg-fff"> <div class="tab_add"> <router-link to="/fans/tabadd" class="tab_title plr"> <i></i><span>新建标签</span> </router-link> </div> <ul class="tab_manage bg-fff pl clearfix"> <li v-for="(todo, index) in todos"> <div :class="[{swipeleft: isSwipe[index]},'tab_manage_list left']" @touchstart.stop="created()" ref="child" :key="index"> <p class="tab">{{ todo.title }}(<span>{{todo.num}}</span>)</p> <p class="tab_content text_hide">{{ todo.text }}</p> </div> <p class="tab_delete left" @click.stop="removeTodo(index)">删除</p> </li> </ul> </div> </template> <script> /* * 滑动配置。distance 滑动距离 */ export default({ data(){ return { isSwipe: [false, false, false], todos: [ { 'text': '范冰冰,范冰冰1,范冰冰2,范冰冰2','num':'3','title':'5月份收房'}, { 'text': '邓超,邓超1,邓超2,邓超2','num':'3','title':'6月份收房'}, { 'text': '赵丽颖,赵丽颖1,赵丽颖2,赵丽颖2,赵丽颖,赵丽颖1,赵丽颖2,赵丽颖2','num':'6','title':'7月份收房'}, { 'text': '范冰冰,范冰冰1,范冰冰2,范冰冰2','num':'3','title':'8月份收房'} ] } }, methods: { removeTodo: function (index) { this.todos.splice(index, 1); this.isSwipe = [false, false, false] }, created:function() { setTimeout(() => { // 判断是否存在信息列表 if (this.$refs.child) { this.$refs.child.forEach((element, index) => { let x, y, X, Y, swipeX, swipeY // 监听touchstart element.addEventListener('touchstart',function(e) { x = e.changedTouches[0].pageX y = e.changedTouches[0].pageY swipeX = true swipeY = true this.isSwipe = [false, false, false] }) element.addEventListener('touchmove', e => { X = event.changedTouches[0].pageX Y = event.changedTouches[0].pageY if (swipeX && Math.abs(X - x) - Math.abs(Y - y) > 0) { // 阻止默认事件 e.stopPropagation() // 右滑 if (X - x > 10) { //滑动间距 e.preventDefault() this.isSwipe.splice(index, 1, false) } if (x - X > 10) { //滑动间距 e.preventDefault() this.isSwipe.splice(index, 1, true) } swipeY = false } if (swipeY && Math.abs(X - x) - Math.abs(Y - y) < 0) { swipeX = false } }) }) } }, 500) } } }) </script> <style scoped src="./tab_manage.css"></style>
/* 标签管理 */.tab_manage_wrap{width: 100%;height: 100%;}.tab_title{display: block;width: 100%;height: 2.56rem;border-bottom: 0.05rem solid #dedede;line-height: 2.56rem;position: relative;}.tab_title i{position: absolute;width: 0.64rem;height: 0.64rem;left: 0.426667rem;top: 0.96rem;background:url(add.png);background-size: 100% 100%;}.tab_title span{display: block;padding-left: 1.493333rem;font-size: 0.597333rem;color: #fe4d57;}.tab_manage{ width: 16rem; margin: 0 auto; overflow-x: hidden; position: relative;}.tab_manage li{position: relative;width:18.56rem;height: 2.56rem;border-bottom: 0.05rem solid #dedede;}.tab_manage_list{height: 2.56rem;width: 15.573333rem;}.swipeleft.tab_manage_list{margin-left: -3rem;} .tab_manage li .tab{font-size: 0.64rem; color: #555; padding-top: 0.426667rem; padding-bottom: 0.213333rem;}.tab_manage li .tab_content{font-size: 0.554667rem;color: #999;width: 15.36rem;}.tab_manage li .tab_delete{height: 2.56rem;width: 2.986667rem;line-height: 2.56rem;text-align: center;font-size: 0.725333rem;color: #fff;background-color: #fe4d57;}/* 标签管理 end */
阅读全文
0 0
- vue移动端模仿qq左右滑动删除
- 模仿qq滑动删除
- 模仿QQ滑动删除效果
- [Android]模仿QQ在listview上滑动出现删除键
- HorizontalDragLayout-模仿QQ客户端的Item滑动删除
- HorizontalDragLayout-模仿QQ客户端的Item滑动删除
- 移动端滑动删除
- 左右滑动弹出按钮,类似于QQ中,左右滑动消息框会弹出删除等按钮
- 模仿QQ的左右滑动切换界面和下拉更新的效果
- Android模仿QQ的左右滑动切换界面和下拉更新的效果
- RecyclerView实现列表Item长按移动、左右滑动删除
- 移动端实现导航的左右滑动
- 移动端左右上下滑动识别
- 移动端图片左右滑动效果
- 移动端按钮组左右滑动
- android 模仿自带的notifacation提示左右滑动删除Listveiw的item项
- vue滑动删除组件
- vue + vue-touch 来实现移动端左右导航效果(有点像京东移动站导航)
- How To Install MySQL on Ubuntu 16.04
- Max OS 安装go (解决can't load package)
- 如何异步处理繁重的业务
- 分析:手机端护照识别sdk
- ConfUtil 读取配置文件工具类
- vue移动端模仿qq左右滑动删除
- 安卓NDK开发案列一:字符串的加密和解密
- effective c++条款总结
- 数据仓库学习笔记01
- BZOJ 1007-水平可见直线
- Markdown语言详解
- PAT--1052. Linked List Sorting
- Spring 获取属性值
- WSGI学习记录