※前提条件:vue3 的uniapp开发
<template> <view class="max" hover-class="box2-active"> <view class="box" hover-class="box-active" hover-stop-propagation :hover-start-time="2000" :hover-stay-time="2000">我是一个大盒子哦</view> </view> </template> <style> .max { width: 200rpx; height: 200rpx; background-color: blue; } .box { width: 100rpx; height: 100rpx; background-color: #F0AD4E; } .box-active { background-color: #007AFF; } .box2-active { background-color: pink; } </style>
属性意思是阻止冒泡 点大盒子的时候小盒子不会变 反之亦然
指定按下去的样式类
也就是点击设置会变颜色
按住后多久出现点击态,单位毫秒
手指松开后点击态保留时间,单位毫秒
Comment: