Skip to content

Latest commit

 

History

History
79 lines (54 loc) · 2.52 KB

common-event.md

File metadata and controls

79 lines (54 loc) · 2.52 KB

Common Events

0.4 cn

Click event

If a click event is bound to a component, the event will be triggered when the user clicks on it.

Notes: The component input and switch do not currently support this event, please use change or input event instead.

event object

  • type: click
  • target: The target component where the event is triggered
  • timestamp: Timestamp when event is triggered.

Appear event

If a appear event is bound to a component inside a scroller, the event will be triggered when the component comes to be visible.

event object

  • type: appear
  • target: The target component where event is triggered
  • timestamp: Timestamp when event is triggered.
  • direction: The direction in which the scroller is scrolling. Should be up or down.

Disappear event

If a disappear event is bound to a component inside a scroller, the event will be triggered when the component scrolls out of viewport and disappears from your sight.

event object

  • type: disappear
  • target: The object where event is triggered
  • timestamp: Timestamp when event is triggered.
  • direction: The direction in which the scroller is scrolling. Should be up or down

Page event

0.6.1

Weex provides you with simple management of page status, such as viewappear and viewdisappear

The viewappear event will be triggered when page is about to show or before any animations are configured for showing. For example, when calling push method in navigator module, this event will be trigged in new page.

The viewdisappear event will be triggeded when page is about to dismiss.

Different from appear and disappear of component, these two events focus on the status of whole page, so they must be bound to the root component.

e.g.

<template>
  <div onviewappear="viewappear" onviewdisappear="viewdisappear">
  		......
  </div>
</template>

<script>
  module.exports = {
    methods: {
      viewappear: function (e) {
        // handle view appear event
      },
      viewdisappear: function (e) {
        // handle view disappear event
    }
  }
</script>

In addititon,these events also can be bound to body component which is not root actually such as wxc-navpage.

event object

  • type: viewappear or viewdisappear
  • target: The object where event is triggered
  • timestamp: Timestamp when event is triggered.