uniapp H5 touchstart touchend 切换背景会失效,或者没用

uniapp H5 touchstart touchend 切换背景会失效,或者没用

  1. 直接上代码 (使用 class 以及 hover-class来设置样式)

  2. class 设置默认的背景图或者样式

  3. hover-class 来设置按下的背景图 或者样式

    抬起
    在这里插入图片描述
    按下
    在这里插入图片描述

<view class="mp_zoom_size ZoomReduceIcon" hover-class="touchZoomReduceIcon">
</view><style lang="scss" scoped>.touchZoomReduceIcon {background-image: url('../../static/img/zoom_reduce_press.png') !important;background-size: 100% 100%;background-repeat: no-repeat;}.ZoomReduceIcon {background-image: url('../../static/img/zoom_reduce.png') !important;background-size: 100% 100%;background-repeat: no-repeat;}
</style>
  1. 搞定!(日常记录)