The previous article explains data binding, templates, logic, and so on. it mainly serves to display data and how to display it in a view. However, only the presentation is not enough. we need to interact with each other. For example, an HTML page can display text and images, but also have some interactions, such as links and buttons. The previous article explains data binding, templates, logic, and so on. it mainly serves to display data and how to display it in a view. However, only the presentation is not enough. we need to interact with each other. For example, an HTML page can display text and images, but also have some interactions, such as links and buttons.
Interaction is actually an event. For example, the onClick of the button in HTML is the action triggered when the button is clicked and the corresponding business logic of the developer.
I. event example: bindtap
Events are the communication between the view layer and the logic layer. Send user behavior feedback to the logic layer for processing. It is usually bound to a component. when triggered, the processing function is executed and parameters can be carried.
Create a button to redirect the page.
Index. wxml:
View layer WXML: Event
Index. js:
ToEvent: function (){
// Jump to the event. wxml page
Wx. navigateTo ({
Url: '/pages/wxml/event'
})
}
Animation
View layer WXML for practical development of small programs: for event-related articles, please follow the PHP Chinese network!