Basics of Mini Program Development - Logs Page Analysis (6)

Y2J
Release: 2017-04-25 09:35:18
Original
3494 people have browsed it

In the previous tutorial, the index page was parsed. This article will parse the logs page.

The old rule is to show the picture first

Basics of Mini Program Development - Logs Page Analysis (6)

logs page

This page contains the return button (used to return to the index page), page title and program startup log list.
Compared with the index page, the logs page has an additional logs.json file to configure the content of the page title

{ "navigationBarTitleText": "查看启动日志" }
Copy after login

For more configuration items, please refer to the configuration applet

   {{index + 1}}. {{log}}  
Copy after login

In logs In .wxml, three tags are defined, namely view, block and text. The view tag is the container, the block is used to bind the logs array, and the text tag is used to display each log. wx:for and wx:for-item are the list binding syntax provided by the mini program box. For more details, please refer to List Rendering

//logs.js var util = require('../../utils/util.js') Page({ data: { logs: [] }, onLoad: function () { this.setData({ logs: (wx.getStorageSync('logs') || []).map(function (log) { return util.formatTime(new Date(log)) }) }) } })
Copy after login

logs.js defines the logs array and caches it locally in the onLoad method. Obtain the program startup time data, and then call the map method of the array to format the time into a string

.log-list { display: flex; flex-direction: column; padding: 40rpx; } .log-item { margin: 10rpx; }
Copy after login

Finally, it is still logs.wxss to control the page style.

At this point, the parsing part of the default generation program is over. This analysis process is to have an overall understanding of the WeChat applet, so many places are not in depth. In the following tutorials, I will continue to explain various aspects of WeChat applet development.

The above is the detailed content of Basics of Mini Program Development - Logs Page Analysis (6). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!