码迷,mamicode.com
首页 > 其他好文 > 详细

触屏时间控制

时间:2018-02-01 00:14:51      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:flex   val   page   tom   order   let   触屏   class   log   

// pages/youxi/dian1.js
Page({

/**
* 页面的初始数据
*/
data: {
bian: 0,
zhuan: 0,
textTure: ‘touchstart‘
},
shiFN: function (e) {
let that = this;
let n = 0;
// 判断是开始还是结束的参数
let textTure = e.type;
that.setData({
textTure: textTure
})
if (textTure == ‘touchstart‘) {
let lovetime = setInterval(function () {
n += 0.5;

if (that.data.textTure == ‘touchend‘) {
clearInterval(lovetime);
}
console.log(n);
that.setData({
bian: n
})
}, 500)

}
},

})
 
 
 
 
 
 
 
 
<view class=‘yx-box‘>
<view class=‘yx-content‘>
<view>{{bian}}</view>
</view>
<view class=‘bt flexca‘>
<view class=‘bt-item‘ bindtouchend=‘shiFN‘ bindtouchstart=‘shiFN‘></view>
</view>
</view>
 
 
 
 
page {
width: 100%;
height: 100%;
}

.yx-box {
width: 100%;
height: 100%;
">red;
position: relative;
padding-bottom: 60px;
}

.bt {
width: 100%;
height: 60px;
position: fixed;
left: 0;
bottom: 0;
}

.bt-item {
width: 45px;
height: 45px;
">blue;
border-radius: 50%;
}

.yx-content {
width: 100%;
height: 100%;
">gray;
}
 

触屏时间控制

标签:flex   val   page   tom   order   let   触屏   class   log   

原文地址:https://www.cnblogs.com/dianzan/p/8395043.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!