Small Program WXML, small program wxml
Series of articles:
Mini-program tutorial-WXSS
References to mini-program tutorials
Events of mini-program tutorials
Small Program tutorial Template
List rendering of Applet tutorials
Conditional rendering of mini-program tutorials
Data Binding in applet tutorial
Mini-program tutorial-WXML
WXML
WXML (WeiXin Markup Language) is a set of label languages designed by MINA. Combined with basic components and event systems, we can build a page structure.
Here are some simple examples to see what WXML can do:
Data Binding
<!--wxml--><text> {{message}} </view>// page.jsPage({ data: { message: 'Hello MINA!' }})
List rendering
<!--wxml--><view wx:for-items="{{array}}"> {{item}} </view>// page.jsPage({ data: { array: [1, 2, 3, 4, 5] }})
Conditional Rendering
<!--wxml--><view wx:if="{{view == 'WEBVIEW'}}"> WEBVIEW </view><view wx:elif="{{view == 'APP'}}"> APP </view><view wx:else="{{view == 'MINA'}}"> MINA IS NOT APP </view>// page.jsPage({ data: { view: 'MINA' }})
Template
<!--wxml--><template name="staffName"> <view> FirstName: {{firstName}}, LastName: {{lastName}} </view></template><template is="staffName" data="...staffA"></template><template is="staffName" data="...staffB"></template><template is="staffName" data="...staffC"></template>// page.jsPage({ data: { staffA: {firstName: 'Hulk', lastName: 'Hu'}, staffB: {firstName: 'Shang', lastName: 'You'}, staffC: {firstName: 'Gideon', lastName: 'Lin'} }})
Event
<view bindtap="add"> {{count}} </view>Page({ data: { count: 1 }, add: function(e) { this.setData({ data: this.data.count + 1 }) }})
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!