Mini program step by step: introduction, text, events, style

高洛峰
Release: 2017-02-28 10:54:04
Original
1734 people have browsed it

Introduction to Mini Programs

The question of whether native APP or Web APP will be the mainstream in the future has been debated for many years. The biggest advantage of native APP is that its ability to call system control interfaces and frameworks is not as good as that of Web APP. Know where to go. Although JD.com provides both mobile APP and mobile H5 pages for users to browse and place orders, those who have used both at the same time can realize that the smoothness of H5 pages is still inferior.
Prior to this, many entrepreneurs completed the implantation of basic functions in WeChat by embedding H5 in the menu bar of official accounts, but these were usually relatively simple pages and the operating experience was relatively average.
The biggest highlight of the mini program launched by WeChat this time is that WeChat provides a wealth of framework components and API interfaces for developers to call, including: interface, view, content, button, navigation, multimedia, location, data, network , gravity induction, etc. With the help of these components and interfaces, mini programs built on WeChat can maintain the same experience as native APPs in terms of running capabilities and fluency.
Mini program registration

Mini programs, subscription accounts, service accounts, and enterprise accounts are now parallel systems, so if you need to use them, you need to register again.
Regarding how to register, please read the official document description, which will not be cumbersome here:
WeChat Mini Program Access Guide
Development Tools

Download from the official website here:
WeChat Mini Program Development tool download address
Okay, the development tool download is complete, and you can start the instance directly after installation.
Introduction to development tools

1. Scan the QR code to log in (you need to register the WeChat applet first)

小程序循序渐进: 简 介、文本、事件、样式

2. Local applet project

小程序循序渐进: 简 介、文本、事件、样式

3. Add a project, just click "No APPID" here

小程序循序渐进: 简 介、文本、事件、样式

4. Okay, you can start coding.
Project directory structure

小程序循序渐进: 简 介、文本、事件、样式

#This directory is automatically generated by just checking the quick start project.

pages folder - contains all page files.

utils folder - contains some js tool sets.

app.js-Startup entry file.

app.wxss - global style sheet file.

app.json - global configuration file.

The .js suffix is ​​a script file, the .json suffix is ​​a configuration file, the .wxss suffix is ​​a style sheet file similar to .css, and the .wxml structure file is similar to .html
Take a look app.json

小程序循序渐进: 简 介、文本、事件、样式

#You can see that the pages project is allocated with the page path and entrance. By default, the first path is used as the entry.
pages/index/index, this project omits the .wxml suffix.
Each page will generate a directory, and each directory has four files by default.
Example

Example 1: Output text

Open index.wxml

小程序循序渐进: 简 介、文本、事件、样式

view is equivalent to a div in html.

image is a picture.

text is text.

Add text code:

小程序循序渐进: 简 介、文本、事件、样式

Effect:

小程序循序渐进: 简 介、文本、事件、样式

Example 2: Modify text Color

Add class

小程序循序渐进: 简 介、文本、事件、样式

小程序循序渐进: 简 介、文本、事件、样式

小程序循序渐进: 简 介、文本、事件、样式

小程序循序渐进: 简 介、文本、事件、样式


##More mini programs step by step: introduction, text, events , style-related articles please pay attention to 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