没有合适的资源?快使用搜索试试~ 我知道了~
首页vue移动端的左右滑动事件详解
本文实例为大家分享了vue移动端左右滑动事件,供大家参考,具体内容如下 <!DOCTYPE html> <html> <head> <meta charset=UTF-8> <title></title> [removed][removed] <meta name=viewport content=width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no> <meta content=telephone=no name
资源详情
资源评论
资源推荐

vue移动端的左右滑动事件详解移动端的左右滑动事件详解
本文实例为大家分享了vue移动端左右滑动事件,供大家参考,具体内容如下
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://unpkg.com/vue"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta content="telephone=no" name="format-detection">
<style>
*{padding: 0;margin: 0;}
body {background: #EEEEEE;}
.box {text-align: center;}
.btn {
position: relative;
width: 70%;
height: 40px;
margin: 150px auto;
border-radius: 20px;
background: #333333;
}
.btn-move {
position: absolute;
left: 0;
top: 0;
width: 40px;
height: 40px;
border-radius: 20px;
background: #ededed;
}
.tt {
font-size: 20px;
color: #008000;
text-align: center;
margin-top: 50px;
}
</style>
</head>
<body>
<div id="box">
<slide-release></slide-release>
</div>
<script type="text/x-template" id="slide">
<div>
<div class="btn" ref='remove'>
<span ref='btnImg' class="btn-move"
@touchstart='touchStart'
@touchmove='touchMove'
@touchend='touchEnd'
:style="slideEffect"
>
</span>
</div>
<p class="tt" v-show="isShow">你滑动成功了!</p>
</div>
</script>
<script>
Vue.component('slide-release',{
template:'#slide',
data:function(){
return {
isShow:false,
startX:0,//开始触摸的位置
moveX:0,//滑动时的位置
endX:0,//结束触摸的位置
disX:0,//移动距离
slideEffect:'',//滑动时的效果,使用v-bind:style="deleteSlider"
}















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0