zoukankan      html  css  js  c++  java
  • 触屏时间控制

    // 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 {
    100%;
    height: 100%;
    }

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

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

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

    .yx-content {
    100%;
    height: 100%;
    ">gray;
    }
     
  • 相关阅读:
    单独设置css的class属性
    理解闭包的使用方法
    npm常用命令和总结
    前端调试之服务器
    gulp 报错的处理——个人经验
    工作经验备忘
    c++:虚函数和纯虚函数(转载)
    snmp学习、配置
    sigar学习
    linux安装VSCode
  • 原文地址:https://www.cnblogs.com/dianzan/p/8395043.html
Copyright © 2011-2022 走看看