https://uniapp.dcloud.io/component/view
视图容器
它类似于传统html中的div,用于包裹各种元素内容
属性说明
| 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| hover-class | String | none | 指定按下去的样式类。当 hover-class=”none” 时,没有点击态效果 |
| hover-stop-propagation | Boolean | false | 指定是否阻止本节点的祖先节点出现点击态,App、H5、支付宝小程序、百度小程序不支持(支付宝小程序、百度小程序文档中都有此属性,实测未支持) |
| hover-start-time | Number | 50 | 按住后多久出现点击态,单位毫秒 |
| hover-stay-time | Number | 400 | 手指松开后点击态保留时间,单位毫秒 |
hover-class举例
<template><view class="content"><view class="box" hover-class="box-active">this is a box</view><view class="">this is a box1</view></view></template><script>export default {data() {return {title: 'Hello'}},onLoad() {},methods: {}}</script><style>.box{height: 100rpx;width: 100rpx;background: #0000FF;}.box-active{background:#ff5500;}</style>
hover-stop-propagation举例
<!-- 本示例未包含完整css,获取外链css请参考上文,在hello uni-app项目中查看 --><template><view><view class="uni-padding-wrap uni-common-mt"><view class="uni-title uni-common-mt">flex-direction: row<text>\n横向布局</text></view><view class="uni-flex uni-row"><view class="flex-item uni-bg-red">A</view><view class="flex-item uni-bg-green">B</view><view class="flex-item uni-bg-blue">C</view></view><view class="uni-title uni-common-mt">flex-direction: column<text>\n纵向布局</text></view><view class="uni-flex uni-column"><view class="flex-item flex-item-V uni-bg-red">A</view><view class="flex-item flex-item-V uni-bg-green">B</view><view class="flex-item flex-item-V uni-bg-blue">C</view></view></view></view></template>
Tips
- 如果使用 ,编译时会被转换为
