https://www.cnblogs.com/yangfengwu/p/11601299.html
First talk about, how to make their project a name change as a new project
Then you can use the software to import project
Note: If you do not change the file inside the "projectname": "lesson3",, open software, you will find
This place also shows lesson2, so be sure to follow the above two steps revised and re-import the project,
If you do not modify the file inside the "projectname": "lesson3" only modify the folder name to import, will find that no matter how late modification "projectname": "lesson3" upper-left corner still show the original project name
You need to delete the project file, close the micro-channel software development, software development micro-channel open
And then re-copy the project, in accordance with the above tips modify folder name and the name of the file inside the project, you can re-import
This section would have thought to do their own page, and then jump to see, but it! I feel or give you a detailed talk about the applet current page
Mainly on the inside of this function
There is less code that, say ,,, good finish after we can learn by analogy, look at the code in another file
In Note: This know like, is not the focus of this section Ha ..... I just let everyone know how come logs page
Is actually a method of providing micro-channel Note: this know like, is not the focus of this section Ha ..... I just let everyone know how come logs page
Note: This know like, is not the focus of this section Ha ..... I just let everyone know how come logs page
Watch now
Inside each page has a data: {} various data put there is placed a source array
Now look at how to use this array
// logs.js const util = the require ( ' ../../utils/util.js ' ) Page ({ Data: { logs: [] }, the onLoad: function () { // page loading time with strip the this .data.logs [ . 1 ] = " 1,111,111,111,111 " ; // array assignments the console.log ( the this .data.logs [ . 1 ]); // print array values the this .setData ({ logs: (wx.getStorageSync ( ' logs ' ) || []). Map (log => { return util.formatTime (new Date(log)) }) }) } })
We may not be used this.XXXX accustomed JS can actually
data inside the data is to use this.data.XXXX assignment and call Kazakhstan
How we make it variable displayed on the page, now talk about this guy
<-! logs.wxml -> <View class = " container log-List " > <-! and the container layout using the List-log -> <text> qqqqqqqq {{}} </ text> <! - add a text display js file this.setData ({qqqqqqqq: XXXX}) XXXX content of text is displayed -> <WX Block: for = " {{}} logs " WX: for -Item = " log " > <text class = " log-Item " > {{+ index . 1 }}. {} {} log </ text> </ Block> </ View>
// logs.js const util = the require ( ' ../../utils/util.js ' ) var GlobalValueStr = " Display information 1111111111 test page " Page ({ Data: { logs: [], // Data which all data is defined in accordance with json format str: " displays information test page 222 222 222 " }, onLoad: function () { // page load time bar with the this .setData ({ qqqqqqqq: " show Ha let me see " }) the this .setData ({ logs: (wx.getStorageSync ( ' logs ' .) || []) Map (log => { return util.formatTime(new Date(log)) }) }) } })
Now it displays the value of the variable to JS
Because onLoad function inside this.setData, so we synthesized a
Now learn a knowledge
This should all know it ,,, if JS function never learned to go to Baidu JS based tutorial Ha ......
We look at the next
Do not know the changed appearance
The next good knowledge
But if I want to give each data array square root of it ????
Is
If the array is large with a map of it .....
.Map array is used (with a call parameter calculation function, each parameter is an array of values)
For example: all data is divided by 2
Of course, you can