uniapp H5 touchstart touchend 切换背景会失效,或者没用
-
直接上代码 (使用
class
以及hover-class
来设置样式) -
class
设置默认的背景图或者样式 -
hover-class
来设置按下的背景图 或者样式抬起
按下
javascript
<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>
- 搞定!(日常记录)