# frame
The goal of the Mini Program Development Framework is to enable developers to develop native applications in WeChat in the simplest and most efficient way possible. APP Experienced services.
The whole Mini Program framework system is divided into two parts:Logical layer(App Service) and View layer(View)。Mini Program provides its own view-level description language WXML
and WXSS
, and based on the JavaScript
It provides a data transfer and event system between the view layer and the logic layer, allowing developers to focus on data and logic.
# Data binding of responses
At the heart of the framework is a responsive data binding system that makes it easy to synchronize data with views. When data is modified, only the data needs to be modified at the logical level, and the view layer will update accordingly.
Look at this simple example:
{% Minicode ('l0gLEKmv6gZa') %}
<!-- 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: 'Weixin'
}
// Register a Page.
Page({
data: helloData,
changeName: function(e) {
// sent Data Change to view
this.setData({
name: 'MINA'
})
}
})
- The developer uses the framework to convert the data in the logical layer
Name
With the view layer'sName
Binding, so it will show when the page is openedHello Weixin!
- When the button is clicked, the view layer sends
changeName
To the logical layer, which finds and executes the corresponding event handler - After the callback function is triggered, the logic layer executes
setData
Of the operation, willData
to hit the targetName
fromWeixin
Turn intoMINA
, because the data and the view layer are already bound, so the view layer automatically changes toHello MINA!
。
# Page management
frame Managed the entireMini ProgramPage routing, you can do seamless switching between pages, and give the page a complete life cycle. All the developer has to do is register the page's data, methods, and life periodic functions to the frame All other complex operations are left to the frame Handle.
# Basic components
frame Provides a set of basic components, which come with WeChat style style and special logic, developers can combine the basic components to create powerfulWeChat Mini Program 。
# Rich API
frame Provide rich WeChat native API, can easily tune up WeChat provides capabilities, such as access to user information, local storage, payment functions, etc.