View

视图容器

属性

属性名类型默认值说明
hoverClassStringnone指定按下去的样式类。当 hover-class='none' 时,没有点击态效果
hoverStartTimeNumber50按住后多久出现点击态,单位毫秒
hoverStayTimeNumber400手指松开后点击态保留时间,单位毫秒
hoverStopPropagationBooleanfalse指定是否阻止本节点的祖先节点出现点击态

各端支持度

属性微信小程序H5ReactNative百度小程序支付宝小程序字节跳动小程序
hoverClass(支持 hoverStyle 属性,但框架未支持 hoverClass)
hoverStartTime
hoverStayTime
hoverStopPropagationx
示例:
  1. import Taro, { Component } from '@tarojs/taro'
  2. import { View, Text } from '@tarojs/components'
  3. export default class PageView extends Component {
  4. constructor() {
  5. super(...arguments)
  6. }
  7. render() {
  8. return (
  9. <View className='components-page'>
  10. <Text>flex-direction: row 横向布局</Text>
  11. <View className='flex-wrp' style='flex-direction:row;'>
  12. <View className='flex-item demo-text-1'/>
  13. <View className='flex-item demo-text-2'/>
  14. <View className='flex-item demo-text-3'/>
  15. </View>
  16. <Text>flex-direction: column 纵向布局</Text>
  17. <View className='flex-wrp' style='flex-direction:column;'>
  18. <View className='flex-item flex-item-V demo-text-1'/>
  19. <View className='flex-item flex-item-V demo-text-2'/>
  20. <View className='flex-item flex-item-V demo-text-3'/>
  21. </View>
  22. </View>
  23. )
  24. }
  25. }