当前位置:网站首页>[wechat applet] global style, local style, global configuration
[wechat applet] global style, local style, global configuration
2022-07-25 07:32:00 【Su liang.py】
Author's brief introduction : Su Liang ( Focus on web crawlers , Data analysis , On the way to learning the front end )
Blog home page : Su Liang .py The blog of
Series column : Basic course of applet development
Aphorisms : The sea is wide with fish , The sky is high and the birds are flying .
If you think the blogger's article is good , I hope you can support me for the third time in a row !!!
Follow the likes collection
List of articles
Style import
Use wxss Provided @import grammar , You can import an external style sheet .
@import grammar
@import Followed by the relative path of the external stylesheet to be imported , use ; End of statement .
example :
- Create a folder in the root directory , Create one in the folder
wxssfile
- In the wxss Write down style , And in page wxss Import the style into the file .

In this way, you can import the outreach style .
Global style
The global style is app.wxss This file , The styles in this will be applied to the overall situation . For every page .

Local style
In the page .wxss Files belong to local styles , Only works on the current page .
Be careful :
- When a local style conflicts with a global style , according to Nearby principle , Local styles override global styles
- When the weight of the local style is greater than or equal to the weight of the global style , Will override the global style
Global configuration
In the applet root directory app.json File is the global configuration file of the applet . Common configuration items are as follows :
- pages
Record the storage path of all pages of the current applet - window
Set the appearance of the applet window globally - tabBar
Set the at the bottom of the applet tabBar effect - style
Whether to enable the new component style
The window component of the applet
window The navigation bar area and background area of the applet can be configured .

Global configuration –window
Commonly used window Configuration properties
| Property name | type | The default value is | explain |
|---|---|---|---|
navigationBarTitleText | String | character string | Navigation bar title text content |
navigationBarBackgroundColor | Hexcolor | #000000 | Navigation bar background color , Such as #000000 |
navigationBarTextStyle | String | white | Navigation bar Title Color , Support only black / white |
backgroundColor | Hexcolor | #ffffff | Background color of window |
backgroundTextStyle | string | dark | The drop-down loading The style of , Support only dark / light |
enablePullDownRefresh | Boolean | false | Enable pull-down refresh globally |
onReachBottomDistance | Number | 50 | Distance from the bottom of the page when the pull-up event is triggered , Unit is px |
stay app.json Found in file window To configure .
Such as : Modify the title and background color of the navigation bar .

Turn on pull-down refresh
Pull down refresh is a proper term for mobile terminal , It refers to the pull-down and sliding operation of your finger on the screen , To reload page data .
stay window Under global configuration , take enablePullDownRefresh Property value changed to true that will do .

stay app.json After the pull-down refresh is enabled in, it will work on every page .
Set background color :
Set up loading style :
This can only be set to dark and light Two styles .

Set the pull-up distance to the bottom
Pull up to touch the bottom is a proper term for mobile terminal , Pull up and slide the screen with your fingers , So as to load more data .
The default distance is 50px, To reset , It's in app.json In the document window Item to configure .
Global configuration –tabBar
tabBar It is a common page effect in mobile applications , It is used to realize the fast switching of multiple pages . Small programs are usually divided into :
- Bottom tabBar
- Top tabBar
Be careful :
- tabBar You can only configure least 2 individual 、 most 5 individual tab Tab .
- When rendering top tabBar when , No display icon, Show only text .
tarBar Of 6 Components
backgroundColor: tabBar Background color of
selectedlconPath: The path of the selected image
borderStyle: tabBar The color of the top border
iconPath: Picture path when not selected
selectedColor : tab The color of the selected text on
color: tab The default of the text on ( Not selected ) Color
tarBar Configuration item of node
| attribute | type | Required | The default value is | describe |
|---|---|---|---|---|
| position | String | no | bottom | tabBar The location of , Support only bottom/top |
| borderStyle | String | no | black | tabBar The color of the top border , Support only black/white |
| color | HexColor | no | tab The default of the text on ( Not selected ) Color | |
| selectedColor | HexColor | no | tab The color of the selected text on | |
| backgroundColor | HexColor | no | tabBar Background color of | |
| list | Array | yes | least 2 individual 、 most 5 individual tabtab List of tabs . |
Every tab Configuration item of item
stay app.json Added to window Flush tabBar Configuration item .
Among them, every tab Items have the following four attribute values .
| attribute | type | Required | describe |
|---|---|---|---|
| pagePath | String | yes | Page path , The page must be in pages Predefined in |
| text | String | yes | tab Text displayed on |
| iconPath | String | no | Icon path when not selected ; When postion by top when , No display icon |
| selectedlconPath | String | no | Icon path when selected ; When postion by top when , No display icon |

边栏推荐
- Use cyclegan to train self-made data sets, popular tutorials, and get started quickly
- 论文阅读:UNET 3+: A FULL-SCALE CONNECTED UNET FOR MEDICAL IMAGE SEGMENTATION
- 关于GBase 自动关闭连接问题
- When importing data in batches, you always prompt "failure reason: SQL parsing failure: parsing file failure:: null". What's the matter?
- Summary of learning notes of deep learning application development (II)
- Huawei wireless device sta black and white list configuration command
- DJI push code (one code for one use, limited time push)
- Luo min's backwater battle in qudian
- Problems in deep learning training and testing: error: the following arguments are required: --dataroot, solution: the configuration method of training files and test files
- 【Unity入门计划】基本概念-预制件 Prefab
猜你喜欢

Introduction to Manhattan distance

Oracle19采用自动内存管理,AWR报告显示SGA、PGA设置的过小了?

Matlab self programming series (1) -- angular distribution function

Pads export Gerber file

A domestic open source redis visualization tool that is super easy to use, with a high-value UI, which is really fragrant!!

QT6 with vs Code: compiling source code and basic configuration

Teach you to use cann to convert photos into cartoon style

Gan series of confrontation generation network -- Gan principle and small case of handwritten digit generation

Before Oracle 19C migration, how important is it to do a good job of rat playback test?
![[cloud native] the ribbon is no longer used at the bottom of openfeign, which started in 2020.0.x](/img/7e/1d27e3f1856ab8c6cbfc5221c717bb.png)
[cloud native] the ribbon is no longer used at the bottom of openfeign, which started in 2020.0.x
随机推荐
Boiling short drama Jianghu: nine of the ten production teams are shooting, with a head sharing fund of more than 30million, and users are addicted to paying routines
How to do a good job in safety development?
[pytorch] the most common function of view
QT learning diary 20 - aircraft war project
[notes] search rotation sort array
The application of for loop and if judgment statement
Nailing the latest version, how to clear the login phone number history data
Introduction to Manhattan distance
Xinku online | cnopendata shareholder information data of A-share listed companies
Delete in elasticserach_ by_ What is the mechanism of query?
做好项目管理的10个关键点和5大措施
scrapy定时爬虫的思路
Paper reading: UNET 3+: a full-scale connected UNET for medical image segmentation
【论文笔记】Next-ViT: Next Generation Vision Transformer for Efficient Deployment in Realistic Industrial
线代(矩阵‘)
【Unity入门计划】基本概念-GameObject&Components
Introduction to cesium
Huawei wireless device sta black and white list configuration command
cesium简介
使用CycleGAN训练自己制作的数据集,通俗教程,快速上手