All Products
Search
Document Center

AXML introduction

Last Updated: Feb 04, 2021

AXML is a set of tag language based on the Mini Program framework to describe the structure of Mini Program pages. AXML syntax can be divided into five parts:

AXML code example:

  1. <!-- pages/index/index.axml -->
  2. <view a:for="{{items}}"> {{item}} </view>
  3. <view a:if="{{view == 'WEBVIEW'}}"> WEBVIEW </view>
  4. <view a:elif="{{view == 'APP'}}"> APP </view>
  5. <view a:else> alipay </view>
  6. <view onTap="add"> {{count}} </view>

Example of the corresponding .js file:

  1. // pages/index/index.js
  2. Page({
  3. data: {
  4. items: [1, 2, 3, 4, 5, 6, 7],
  5. view: 'alipay',
  6. count: 1,
  7. },
  8. add(e) {
  9. this.setData({
  10. count: this.data.count + 1,
  11. });
  12. },
  13. });