View
A view container, equivalent to the div label of Web or the View component of React Native.
Attributes
Attribute | Type | Default value | Description | Minimum version |
disable-scroll | Boolean | false | Whether or not to prevent page scrolling in the area | - |
hover-class | String | - | Style class added when tapping | - |
hover-start-time | Number | - | The period that the button has been held before the tapped status appears, in milliseconds | - |
hover-stay-time | Number | - | The period that the tapped status lasts after the button is released, in milliseconds | - |
hidden | boolean | false | Whether or not to hide | - |
class | String | - | Custom style name | - |
style | String | - | Inline style | - |
animation | - | - | Used for animation. See my.createAnimation for more information | - |
hover-stop-propagation | Boolean | false | Whether to prevent the ancestor elements of the current element from appearing in the click state | |
onTap | EventHandle | - | Tap | - |
onTouchStart | EventHandle | - | Touch action starts | - |
onTouchMove | EventHandle | - | Moves after touching | - |
onTouchEnd | EventHandle | - | Touch action ends | - |
onTouchCancel | EventHandle | - | The touch action is interrupted such as by incoming call and pop-up dialog | - |
onLongTap | EventHandle | - | Triggered after a long press of 500 ms. When a long press event is triggered, moving will not trigger the screen scrolling | - |
onTransitionEnd | EventHandle | - | Trigger when the transition ends | |
onAnimationIteration | EventHandle | - | Trigger when a new animation process is started every time (not triggered for the first time) | |
onAnimationEnd | EventHandle | - | Trigger when the animation ends | |
onAppear | EventHandle | - | Trigger when the current element is visible | |
onDisappear | EventHandle | - | Trigger when the current element changes from visible to invisible | |
onFirstAppear | EventHandle | - | Trigger when the current element becomes visible for the first time |
The animation generated by using my.createAnimation is implemented through transition and only triggers onTransitionEnd; it does not trigger onAnimationStart, onAnimationIteration, or onAnimationEnd.
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">
Like!
</view>
<view class="postBody__date">
June 1
</view>
</view>
</view>