Practical development of applets ④ --- View layer WXML binding data, templates, templates... the previous article introduced the MVC structure of applets:
Page. js is the control layer (C), also called the business logic layer;
Data attribute in page. js, that is, data model layer (M );
Page. wxml is the presentation layer (V );
Page. wxss is css, enhancing the display layer effect.
Modify the data attribute (M) through the business logic layer (C) to display the data in the presentation layer (V.
That is, the MVC design pattern.
I. data binding
First, let's take a look at the MVC process structure of the Page.
If a variable is defined in data, such
Page ({data: {title: 'Small program practice tutorial ', desc: 'View layer-wxml '}})
You can use {title} on the page to display the effect, as shown in the figure below:
For more information about how to bind data, templates, and templates to the view layer WXML of applets, see The PHP Chinese web!