当前位置:网站首页>Wechat applet learning notes 2
Wechat applet learning notes 2
2022-07-26 09:50:00 【~ light boat ~】
One 、 Start of applet
stay app.json Of pages You can see all the page paths of the applet , Written in pages The first page of the field is the homepage of the applet
Wechat client loads the homepage code and then passes some mechanisms at the bottom of the applet , You can render this page
Then let's look at the functions executed after the applet starts !
When the program is executed, it will execute the life cycle function , This is the same as other client programs .
The life cycle function of the applet is in app.js in onLaunch in
App({
onLaunch: function () {
// After the applet starts Trigger
}
// Triggered when the applet is displayed
onShow:function(){
console.log(" Life cycle function - Triggered when the firm applet displays ");
},
// Triggered when the applet is hidden
onHide:function(){
console.log(" Life cycle function - Triggered when the firm applet is hidden ");
},
// Global properties
globalData: {
userInfo: null
}
})
Two 、 Programs and pages
We can see that there are usually four kinds of files under one folder , The client will first according to .json Configuration generates an interface , The top color and text can be in json The file defines . Then the page will be loaded wxml The structure and wxss style . Finally installed in .js,js It's basically like this
//index.js
Page({
data: {
text: "This is page data."
},
onLoad: function(options) {
// Do some initialize when page load.
},
onReady: function() {
// Do something when page ready.
},
onShow: function() {
// Do something when page show.
},
onHide: function() {
// Do something when page hide.
},
onUnload: function() {
// Do something when page close.
},
onPullDownRefresh: function() {
// Do something when pull down.
},
onReachBottom: function() {
// Do something when page reach bottom.
},
onShareAppMessage: function () {
// return custom share data when user share.
},
onPageScroll: function() {
// Do something when page scroll
},
// Event handler.
viewTap: function() {
this.setData({
text: 'Set some data for updating view.'
}, function() {
// this is setData callback
})
},
customData: {
hi: 'MINA'
}
})
Page It's a page builder , This constructor generates a page . When generating pages, you will put data Data and wxml Render the final structure together , After rendering, the page will be onLoad Callback , We can handle our own logic in the callback .
3、 ... and 、 Components
Components correspond to various controls of program development , However, applet controls have been integrated .
Component list :( Seven categories )
View container has view、scroll-view 、swiper( View container 、 Scrollable view container 、 Slider view container )
The basic content :
icon( Icon )text( written words )progress( Progress bar )
Forms :
button( Button )form( Forms )input( Input box )...
……
good , Next , Start the journey of applet !!!
边栏推荐
- The whole process of server environment configuration
- Sublime install plug-ins
- AR model in MATLAB for short-term traffic flow prediction
- (2) Hand eye calibration of face scanner and manipulator (eye out of hand: nine point calibration)
- Fiddler packet capturing tool for mobile packet capturing
- Fuzzy PID control of motor speed
- Node memory overflow and V8 garbage collection mechanism
- 高斯消元的应用
- Customize permission validation in blazor
- Audio and video knowledge
猜你喜欢
Sqoop【环境搭建 01】CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
苹果独占鳌头,三星大举复兴,国产手机在高端市场颗粒无收
2022 zhongkepan cloud - server internal information acquisition and analysis flag
The problem of accessing certsrv after configuring ADCs
regular expression
服务发现原理分析与源码解读
Node memory overflow and V8 garbage collection mechanism
matlab simulink实现模糊pid对中央空调时延温度控制系统控制
SSG框架Gatsby访问数据库,并显示到页面上
Matlab Simulink realizes fuzzy PID control of time-delay temperature control system of central air conditioning
随机推荐
[datawhale] [machine learning] Diabetes genetic risk detection challenge
The combination of officially issued SSL certificate and self signed certificate realizes website two-way authentication
Fuzzy PID control of motor speed
WARNING: [pool www] server reached pm. max_ children setting (5), consider raising it
MySQL 5.7.25 source code installation record
Use of OpenCV class
Global variables in DLL
JS judge the data types object.prototype.tostring.call and typeof
[information system project manager] summary of essence of high-level series for the first time
Wechat H5 payment on WAP, for non wechat browsers
系统安装Serv-U后IIS出错提示:HRESULT:0x80070020
The whole process of server environment configuration
配置ADCS后访问certsrv的问题
SSG框架Gatsby访问数据库,并显示到页面上
Registration module use case writing
Add DLL
JS table auto cycle scrolling, mouse move in pause
Principle analysis and source code interpretation of service discovery
电机转速模糊pid控制
解释一下自动装箱和自动拆箱?