企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
>[success] # view -- 视图容器 1. 视图组件(块级元素,独占一行,通常用作容器组件)类似`html `中 `div` | 属性 | 类型 | 默认值 | 必填 | 说明 | 最低版本 | | --- | --- | --- | --- | --- | --- | | hover-class | string | none | 否 | 指定按下去的样式类。当`hover-class="none"`时,没有点击态效果 | [1.0.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) | | hover-stop-propagation | boolean | false | 否 | 指定是否阻止本节点的祖先节点出现点击态 | [1.5.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) | | hover-start-time | number | 50 | 否 | 按住后多久出现点击态,单位毫秒 | [1.0.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) | | hover-stay-time | number | 400 | 否 | 手指松开后点击态保留时间,单位毫秒 | [1.0.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) | >[info] ## 代码 * index.wxss ~~~css .active { background-color: skyblue; } .active-b { background-color: yellow; } ~~~ * 默认配置 hover-stop-propagation 时候 ![](https://img.kancloud.cn/10/d9/10d933f459b6845041440aa72f7f5ba0_435x58.png) * 配置 hover-stop-propagation 为 true 时候 ![](https://img.kancloud.cn/21/64/216405ef8c9f3efbf72b96e4fb6439ae_409x59.png) * 整个效果 ![](https://img.kancloud.cn/26/c4/26c45766a4a22d37f359fe78dd52d156_398x155.png) ~~~html <view>哈哈哈</view> <view hover-class="active">我是view组件点击后我会渲染触发class</view> <view hover-class="active"> 父元素 <view hover-class="active-b" hover-stop-propagation hover-start-time="500">这是子元素</view> </view> <view hover-class="active"> 父元素 <view hover-class="active-b" hover-start-time="500">这是子元素</view> </view> ~~~