Framework

The goal of the Mini Program development framework is to enable developers to develop services with a native APP experience on WeChat in a simplest and most efficient way possible.

The framework provides its own view layer description languages WXML and WXSS, as well as a JavaScript-based logical layer framework, and provides a data transfer and event system between the view layer and the logical layer, allowing developers to focus on data and logic.

Responsive data binding

The core of the framework is a responsive data binding system.

The entire Mini Program framework system is divided into two parts, including a view layer (View) and a logic layer (App Service).

The framework keeps data and views in sync in a simple way. When the data needs to be changed, you only need to modify it in the logical layer, and the view layer will update accordingly.

Look at this simple example:

Preview with Developer Tool

<!-- This is our View -->
<view> Hello {{name}}! </view>
<button bindtap="changeName"> Click me! </button>
// This is our App Service.
// This is our data.
var helloData = {
  name: 'WeChat'
}

// Register a Page.
Page({
  data: helloData,
  changeName: function(e) {
    // sent data change to view
    this.setData({
      name: 'MINA'
    })
  }
})
  • The developer uses a framework to bind name in the logical layer data to name in the view layer, so Hello WeChat! appears as soon as the page opens;
  • When the button is taped, the view layer sends changeName events to the logical layer, which finds and executes corresponding event handlers.
  • After the callback function is triggered, the logical layer executes setData to change the name in data from WeChat to MINA (The data and the view layer are bound), so that the view layer automatically changes to Hello MINA!.

Page management

The framework manages the entire page routing of the Mini Program, which enables seamless switching between pages and gives the page a complete lifecycle. The developer only needs to register the data, methods, and lifecycle functions of the page to the framework. All other complex operations are handled by the framework.

Basic components

The framework provides a set of basic components that come with WeChat styles and special logic. The developers can create powerful WeChat Mini Programs by combining such base components.

Rich APIs

The framework provides a rich set of WeChat native APIs, which can easily invoke the capabilities provided by WeChat, such as user information access, local storage, and payment functions.