Issues that should be paid attention to when developing sharing mini program pages

零下一度
Release: 2017-05-24 09:22:05
Original
2030 people have browsed it

This article mainly introduces relevant information compiled by WeChat Mini Program page development precautions. Friends in need can refer to the

Mini Program Development Precautions:

1, jsFile

The js file corresponding to each page can define page onReady, onLoad, onShow, onHide, onUnload, as well as page data, custom functions should be written in one piece, and the internal agreement is to write them all after the default function. That is, "first data on the page, then default functions, and then customized functions" facilitates code review and improves collaboration efficiency.

2, jsonFile

The default cannot be empty, even if there is no content, it must be empty data{}, originally defined in app.json If the content in the needs to be redefined in the current page, then just copy the content and directly assign new values, which can be used to set the status bar, navigation bar, title, and window background color of the mini program. The most commonly used one is the title of the page

{
 "navigationBarTitleText": "我的",
 "selfdata":"全栈工程师师不靠谱更新",
 "tabBar": {
  "list": [{
  "pagePath": "pagePath",
  "text": "text",
  "iconPath": "iconPath",
  "selectedIconPath": "selectedIconPath"
  }],
  "position":"top"
 }
}
Copy after login

I’m used to having the menu at the bottom, so let’s have one at the top.

3. wxml file

The head and bottom of the page need to be encapsulated, made into templates, and imported into the page respectively

<import src="/pages/common/head.wxml"/>
<import src="/pages/common/foot.wxml"/>
Copy after login

The previous HTML written A good habit is to bring in the head and foot. Of course, the business content is the body. Each piece is wrapped with a view to facilitate control of the layout and class

obtained when the page is loaded. Data, from the network or from cache, is then rendered on the page through the content defined in the page's data. There are many uses for specific presentation lists and conditions.

4, wxssFiles

@import "common.wxss";
Copy after login

Public styles and reset styles should be managed in advance according to different projects, do not use them px, don’t use px, don’t use px, important things have to be said three times. In order to ensure compatibility and adaptability, the mini program uses a new unit rpx

5. Provide a system for users to clean up the local area. Cached button. Equivalent to the reset switch of the project, cache data, file data, and authorization data may be used in different projects.

【Related Recommendations】

1. Complete source code download of WeChat mini program

2. Chai Ge WeChat mini program application Store source code

3. WeChat applet demo: Yangtao

The above is the detailed content of Issues that should be paid attention to when developing sharing mini program pages. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template