zoukankan      html  css  js  c++  java
  • 小程序开发之点击事件

    在小程序的api中发现点击事件有两种bindtap和catchtap两个,发现两个都可以实现点击事件该有的功能,但是到底有什么区别呢?
    • 用法的区别:
      • bintap会发生冒泡事件,catchtap不会发生冒泡事件
    注:返回结果
    • type
      • 点击事件的类型
    • changedTouches
      • 元素距离文档的x轴,y轴,可视窗口的x轴,y轴的距离。
    • currentTarget(常用)
      • 绑定该事件的元素
      • dataset
        • 元素上的自定义属性
      • id
        • 元素的id
      • offsetLeft
        • 元素距离具有定位元素的左侧的距离
      • offsetTop
        • 元素相对于具有定位元素的顶部的距离
    • target
      • 事件的监听,事件引发的一系列后续变化
      • id
        • 元素的id
      • offsetLeft
        • 元素距离具有定位元素的左侧的距离
      • offsetTop
        • 元素相对于具有定位元素的顶部的距离
      • dataset
        • 元素上的自定义属性
    • timeStap
      • 事件触发的时间戳
    • touches
      • 滑动触发
      • 文档的左侧,顶部距离,可视窗口的左侧,顶部距离
  • 相关阅读:
    CSU 1122
    CSU 1256
    CSU 1240
    HDU 1874
    CSU 1004
    Problem F CodeForces 16E
    Problem E CodeForces 237C
    Problem C FZU 1901
    12-30
    2016-12-29
  • 原文地址:https://www.cnblogs.com/bgwhite/p/9335547.html
Copyright © 2011-2022 走看看