当前位置:网站首页>Global configuration and page configuration of wechat applet development
Global configuration and page configuration of wechat applet development
2022-07-25 19:26:00 【Aricl.】
Catalog
(1) Components of applet window
(3) Drop down to refresh the page
(4) Pull up the distance to the bottom
(5) Bottom navigation bar tabBar
(2) The relationship between page configuration and global configuration
(3) Common configuration items
3、 ... and 、 Comprehensive case
(2) Effect drawing of real machine debugging
One 、 Global configuration
app.json File is the global configuration file of the project

(1) Components of applet window

(2) The navigation bar navigationBar
1)window Common configuration items of nodes

2) Set up the navigation bar
- Set navigation bar title text
app.json-->window-->navigationBarTitleText
- Set the background color of the navigation bar
app.json-->window-->navigationBarBackgroundColor
- Set the title color of the navigation bar
app.json-->window-->navigationBarTextStyle
app.json In file window Node code
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#13227a",
"navigationBarTitleText": "Hello",
"navigationBarTextStyle":"white"
}, 
(3) Drop down to refresh the page
1) Concept
Pull down refresh is a noun of the mobile terminal , It refers to the pull-down and sliding operation of your finger on the screen , To reload page data
2) Set dropdown refresh
- Turn on pull-down refresh
app.json-->window-->enablePullDownRefresh-->true
- Set the background color of the window when the drop-down is refreshed
app.json-->window-->backgroundColor--> Specify the hexadecimal color value #efefef
- When setting the pull-down refresh loading style
app.json-->window-->backgroundTextStyle-->dark
"window":{
"navigationBarBackgroundColor": "#13227a",
"navigationBarTitleText": "Hello",
"navigationBarTextStyle":"white",
"enablePullDownRefresh": true,
"backgroundColor": "#efefef",
"backgroundTextStyle":"dark"
}, 
(4) Pull up the distance to the bottom
1) Concept
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
2) Set up
app.json-->window-->onReachBottomDistance--> Set new value
Be careful : The default bottom touch distance of the applet is 50px, If there are no special needs , Then use the default value directly
(5) Bottom navigation bar tabBar
1) Concept
tabBar It is a common page effect in mobile applications , For realizing multi page Fast switch
Small program tabBar There are two kinds of
- Bottom tabBat( Commonly used )
- 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 Icon , Show only text
tabBar Of 6 Components

2)tabBar Node configuration item

3) Every tab Configuration options for item

4) Example

app.json In file tabBar Node code
"tabBar": {
"list": [{
"pagePath": "pages/index/index",
"text": " home page ",
"iconPath": "images/home.png",
"selectedIconPath": "images/home-active.png"
},
{
"pagePath": "pages/message/message",
"text": " news ",
"iconPath": "images/message.png",
"selectedIconPath": "images/message-active.png"
},
{
"pagePath": "pages/contract/contract",
"text": " Contact us ",
"iconPath": "images/contract.png",
"selectedIconPath": "images/contract-active.png"
}
]
}, 
matters needing attention
- You can create a new one under the root directory of the project image Folder , To specifically store what the project needs to use icon Icon
- As tabBar Your page must be placed in app.json In file Pages Node front , otherwise Unable to jump normally ( Bear in mind )
(5) Icon acquisition
Bloggers strongly recommend Alibaba library vector network , free , And the icons are rich , A really conscientious practical website !

Two 、 Configuration page
(1) Concept
Small program , Every page has its own .json Page profile , Used to the window appearance of the current page 、 Page effects, etc. for specific configuration
(2) The relationship between page configuration and global configuration
- app.json Medium window node , You can globally configure the window performance of each page in the applet
- If a page wants a special window appearance , You can use page level .json Configure text to configure
- When the global configuration conflicts with the page configuration , according to “ Nearby principle ”, It will override the global configuration based on the page configuration
(3) Common configuration items

The configuration method is the same as the global configuration , Don't show .
3、 ... and 、 Comprehensive case
This case is the initial implementation of the home page interface of the local life applet
(1) step
- First configure the navigation bar effect
- Configure the bottom tabBar effect
- Implement the top rotation chart
- Realize the Jiugongge function box
- Realize the bottom picture layout
(2) Effect drawing of real machine debugging

(3) Complete code
- js file
// index.js
Page({
data: {
image: [{path:"/images/food.png",name:" Eat delicious food "},{path:"/images/wash.png",name:" About taking a bath "},{path:"/images/marry.png",name:" Married "},{path:"/images/KTV.png",name:" To sing "},{path:"/images/work.png",name:" job-hunting "},{path:"/images/teacher.png",name:" Apply for counseling "},{path:"/images/car.png",name:" Keep a car "},{path:"/images/hotel.png",name:" Book a hotel "},{path:"/images/fush.png",name:" Looking for decoration "}],
},
onLoad:function(options) {
console.log(options)
}
})
( The image path needs to be customized )
- json file
{
"usingComponents": {
"mt-test1":"/components/test/test1"
},
"enablePullDownRefresh": true,
"backgroundColor": "#efefef",
"backgroundTextStyle": "dark"
}
- wxml file
<!-- The effect of the rotation picture at the top of the home page -->
<swiper indicator-dots indicator-color="white" circular autoplay >
<swiper-item>
<image src="/images/locallife.png" ></image>
</swiper-item>
<swiper-item>
<image src="/images/locallife2.png"></image>
</swiper-item>
<swiper-item>
<image src="/images/locallife3.png"></image>
</swiper-item>
</swiper>
<!-- Jiugongge functional area -->
<!-- Outer container -->
<view class="gridList">
<!-- Inner container -->
<navigator class="gridItem" wx:for="{
{image}}" url="/pages/shoplist/shoplist?title={
{item.name}}">
<image src="{
{item.path}}"></image>
<text>{
{item.name}}</text>
</navigator>
</view>
<!-- Bottom picture function block -->
<view class="img-box">
<image src="/images/tuijian.png" mode="widthFix"></image>
<image src="/images/pingjia.png" mode="widthFix"></image>
</view>
- wxss file
swiper {
height: 400rpx;
}
swiper image{
width: 100%;
height: 100%;
}
.gridList{
/* flex Layout format */
display: flex;
/* Allow word wrap */
flex-wrap: wrap;
/* Add border lines to the left and top of the outer container */
border-left: 1rpx solid #efefef;
border-top: 1rpx solid #efefef;
}
.gridItem{
width: 33.33%;
/* Fixed height of each picture */
height: 200rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
/* Add the right and bottom border lines to each item in the inner container */
border-right: 1rpx solid #efefef;
border-bottom: 1rpx solid #efefef;
/* Change the way of the box to border-box */
box-sizing: border-box;
}
.gridItem image{
width: 60rpx;
height: 60rpx;
}
.gridItem text{
font-size: 24rpx;
/* Set the distance between the text and the top of the picture */
margin-top: 10rpx;
}
.img-box{
display: flex;
padding: 20rpx 10rpx;
justify-content: space-around;
}
.img-box image{
width: 45%;
}
You can see it here , You might as well like it and then slip away (doge)
边栏推荐
- Common development software download addresses
- Actual combat of MySQL database design project of online mall system
- 一个函数中写多少行代码比较合适呢? 代码整洁之道
- 由一个蓝桥杯基础题报时助手而引出的常见误区
- 帝国CMS7.5仿《问答库》题库问答学习平台网站源码 带手机版
- 阿姆利塔工程学院|用于情感分析的方面术语提取中优化采样的强化主动学习方法
- 【iniparser】项目配置工具iniparser的简单使用
- Selenium 设置元素等待的三种方式详解
- [web technology] 1391 page visualization building tool, previous life and present life
- Grid layout frequently asked interview questions
猜你喜欢

The degree of interval of basic music theory

CLIP还能做分割任务?哥廷根大学提出一个使用文本和图像prompt,能同时作三个分割任务的模型CLIPSeg,榨干CLIP能力...

Improvement of wechat applet 28 hot search list ①

An idea of solving div adapting to screen

What is the application value of MES management system

安全基础6 ---漏洞复现

Website construction of information exchange platform for China Africa South South cooperation based on PHP

Internal network planning and design of Yingcheng hospital

二叉树可视化

Eve - 0day Threat Intelligence
随机推荐
【刷题记录】21. 合并两个有序链表
ERROR: role “admin“ cannot be dropped because some objects depend on itDETAIL:
Binary tree visualization
重磅!《几何深度学习》新书发布,帝国理工/DeepMind等图ML大牛共同撰写,160页pdf阐述几何DL基础原理和统一框架
【iniparser】项目配置工具iniparser的简单使用
Leetcode skimming: dynamic programming 07 (different binary search trees)
[applet development] common components and basic usage details
Use of swift basic codable (jsonencoder jsondecoder)
高端旗舰投影仪选购指南:当贝X3 Pro、当贝F5观影更沉浸!
小程序毕设作品之微信校园维修报修小程序毕业设计成品(2)小程序功能
Full scale and Xuan of C key
微信小程序10-微搭模板
网上商城系统MySql数据库设计项目实战
Small program completion work wechat campus maintenance application small program graduation design finished product (2) small program function
[Detr for 3D object detection] detr3d: 3D object detection from multi view images via 3D-to-2D queries
房地产行业大洗牌
Flutter 小技巧之优化你使用的 BuildContext
Hongmeng - Damiao computing Sketchpad - VIDEO
小程序毕设作品之微信校园维修报修小程序毕业设计成品(1)开发概要
Grid layout frequently asked interview questions