View container, equivalent to the div tag of the Web or the View component of React Native.
| Attribute | Type | Default value | Description | Minimum version |
|---|---|---|---|---|
| disable-scroll | Boolean | false | Whether to prevent page scroll in the area. | - |
| hover-class | String | - | Style class added when you tap. | - |
| hover-start-time | Number | - | Time when the tapping state appears after you press and hold, in milliseconds. | - |
| hover-stay-time | Number | - | Duration of the tapping state after you loose. | - |
| hidden | boolean | false | Whether to hide. | - |
| class | String | - | Custom style name. | - |
| style | String | - | The inline style | - |
| animation | - | - | Used for animations. For details, see my.createAnimation. | - |
| hover-stop-propagation | Boolean | false | Whether to prevent the ancestor element of the current element from appearing the clicked state. | 1.10.0 |
| onTap | EventHandle | - | Tap. | - |
| onTouchStart | EventHandle | - | Start the touch action. | - |
| onTouchMove | EventHandle | - | Move after the touch action. | - |
| onTouchEnd | EventHandle | - | End the touch action. | - |
| onTouchCancel | EventHandle | - | Tapping action interrupted by call reminder or pop-up window. | - |
| onLongTap | EventHandle | - | Triggered after you press and hold for 500 ms. After this event is triggered, the screen does not scroll when you move. | - |
| onTransitionEnd | EventHandle | - | Triggered when the transition ends. | 1.8.0 |
| onAnimationIteration | EventHandle | - | Triggered every time when a new animation process is started. (It is not triggered at the first time.) | 1.8.0 |
| onAnimationEnd | EventHandle | - | Triggered when the animation ends. | 1.8.0 |
| onAppear | EventHandle | - | Triggered when the current element is visible. | 1.9.0 |
| onDisappear | EventHandle | - | Triggered when the current element changes from visible to invisible. | 1.9.0 |
| onFirstAppear | EventHandle | - | Triggered when the current element is visible for the first time. | 1.9.4 |
Note: The animation that
my.createAnimation generates is realized using transition and can trigger onTransitionEnd only. onAnimationStart, onAnimationIteration, or onAnimationEnd will not be triggered.Code sample
<view class="post"><!-- hidden --><view class="postUser" hidden><view class="postUser__name">Jessie</view></view><!-- hover class --><view class="postBody" hover-class="red"><view class="postBody__content">Nice!</view><view class="postBody__date">June 1</view></view></view>