当前位置:网站首页>[wechat applet] basic use of common components (view/scroll-view/wiper, text/rich-text, button/image)
[wechat applet] basic use of common components (view/scroll-view/wiper, text/rich-text, button/image)
2022-06-30 16:51: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
Daily recommendation
Recommend an artifact to everyone . Whether you are a student party or an office worker, you can use , The interview question bank is covered here , Brush questions online , Interviews with major manufacturers / Written test questions, etc . If you're still a student , The most important point is the simulated interview function , intelligence AI1v1 interview , Help you get to the big factory as soon as possible offer! Click the link to go directly to !=> Cattle from - Looking for work artifact
Common view container class components
view
Normal view area , Be similar to HTML Medium div, It's a Block-level elements Often used to Realize the layout effect of the page .
WXML Code :
WXSS Code :
Realization effect :

Flex Layout portal :【 Applet 】&【web front end 】 necessary -Flex Detailed layout ( Elastic box )
scroll-view( rolling )
Scrollable view area , Often used to Implement scrolling list effect .
Add attribute scroll-y, That is, vertical scrolling .scroll-x, That is, horizontal scrolling .
WXML Code :
WXSS Code :
Realization effect :
swiper and swiper-item( Shuffling figure )
Carousel map container assembly , Shuffling figure item Components
swiper Common properties of components
| attribute | type | The default value is | explain |
|---|---|---|---|
indicator-dots | boolean | false | Display panel indicator |
indicator-color | color | rgba(0,0,0,3) | Indicate the color |
indicator-active-color | color | #000000 | The currently selected indicator color |
autoplay | boolean | false | Auto switch or not |
interval | number | 5000 | Auto switch interval |
circular | boolean | false | Whether to adopt the joint sliding |
WXML Code :
WXSS Code :
Realization effect :
Common basic content components
text
Text component , Be similar to HTML Medium span label , It's a Inline elements .
Use text Component and add selectable attribute It can achieve the effect of long press to select .
WXML Code :
Realization effect :
rich-text
Rich text component , Support hold HTML The string is rendered as WXML structure .
adopt rich-text Component's nodes attribute node , hold HTML The string is rendered as the corresponding UI structure .
WXML Code :
Realization effect :
Other common components
button
Button components , Functional ratio HTML Medium button Rich buttons , adopt open-type attribute Sure Call various functions provided by wechat ( Customer service 、 forward 、 Get user authorization 、 Access to user information, etc )
Three button styles
General button / Main tone button / Warning button , Default Wrap 
style :
Small button (mini)
Set up size="mini" that will do , Do not wrap after setting 
style :
Hollow button (plain)
Remove background color . add to plain attribute that will do .
style :
image
Picture components ,image The default width of the component is about 300px、 The height is about 240px
adopt src attribute Add image address :

image Of mode attribute
| mode value | explain |
|---|---|
scaleToFill | ( The default value is ) Zoom mode , Do not keep aspect ratio zooming picture , Stretch the width and height of the picture completely to fill image Elements |
aspectFit | Zoom mode , keep Aspect ratio zoom picture , Make the long edges of the picture fully visible . in other words , The picture can be displayed completely . |
aspectFill | Zoom mode , Keep the aspect ratio scaled , Only make sure that the short side of the picture is fully displayed . in other words , Pictures are usually complete only horizontally or vertically , Intercept will occur in the other direction . |
widthFix | Zoom mode , The width does not change , Automatic height change , Keep the aspect ratio of the original image unchanged |
heightFix | Zoom mode , The height remains the same , The width changes automatically , Keep the aspect ratio of the original image unchanged |
Let's see the effect :
- scaleToFill

- aspectFill

- aspectFit

- widthFix

- heightFix

Here we have introduced the basic components commonly used in small programs , Welcome to subscribe to this column , Ongoing update …
More question banks and summary of knowledge points , Interview skills => Cattle from , Come and brush the questions with me !
边栏推荐
- AVIC UAV technology innovation board is listed: the fist product with a market value of 38.5 billion is pterodactyl UAV
- halcon知识:区域专题【07】
- Niuke.com: minimum cost of climbing stairs
- 聊聊远程办公那些事儿 | 社区征文
- Additional: (not written yet, don't look at ~ ~ ~) webmvcconfigurer interface;
- MC Instruction Decoder
- 利用PIL进行不失真的resize
- Tutoriel etcd - chapitre 8 API compacte, Watch et lease pour etcd
- [time series database incluxdb] code example for configuring incluxdb+ data visualization and simple operation with C under Windows Environment
- [bjdctf2020]the mystery of ip|[ciscn2019 southeast China division]web11|ssti injection
猜你喜欢

备战数学建模35-时间序列预测模型

I implement "stack" with C I

MC Instruction Decoder

Symantec electronic sprint technology innovation board: Tan Jian, the actual controller, is an American who plans to raise 620million yuan

Cesium-1.72 learning (add points, lines, cubes, etc.)

搬运两个负载均衡的笔记,日后省的找

MC Instruction Decoder
MySQL开放远程连接权限的两种方法

备战数学建模33-灰色预测模型2

微信表情符号写入判决书,你发的OK、炸弹都可能成为“呈堂证供”
随机推荐
Mysql8.0 method and steps for enabling remote connection permission
Bc1.2 PD protocol
Hundreds of lines of code to implement a JSON parser
Tencent two sides: @bean and @component are used on the same class. What happens?
php7.3 centos7.9安装sqlserver扩展
After 15 years of working on 21 types of hardware, where is Google?
go-micro教程 — 第一章 快速入门
腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?
招标公告:2022年台州联通Oracle一体机和数据库维保服务项目
新茶饮“死去活来”,供应商却“盆满钵满”?
Yunhe enmo won the bid for Oracle maintenance project of Tianjin Binhai rural commercial bank in 2022-2023
The inspiration from infant cognitive learning may be the key to the next generation of unsupervised machine learning
Restartprocessifvisible process
Observation cloud reached in-depth cooperation with tdengine to optimize enterprise cloud experience
快照和备份
异常类_日志框架
RT thread heap size Setting
9:第三章:电商工程分析:4:【通用模块】;(待写……)
microblaze 串口学习·2
牛客网:最小花费爬楼梯
