WeChat mini-app WXML and Wechat mini-app wxml

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.