当前位置:网站首页>[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 !
边栏推荐
- 【牛客网刷题系列 之 Verilog快速入门】~ 位拆分与运算
- Etcd教程 — 第九章 Etcd之实现分布式锁
- jspreadsheet/CE JExcel数据字段比给的字段(columns)多会导致空白列的问题解决方案
- Halcon knowledge: matrix topic [02]
- 更多龙蜥自研特性!生产可用的 Anolis OS 8.6 正式发布
- [activity registration] it's your turn to explore the yuan universe! I will be waiting for you in Shenzhen on July 2!
- 9:第三章:电商工程分析:4:【通用模块】;(待写……)
- 2022蓝桥杯国赛B组-2022-(01背包求方案数)
- Halcon knowledge: regional topics [07]
- 新茶饮“死去活来”,供应商却“盆满钵满”?
猜你喜欢
Anaconda下安装Jupyter notebook
19:00 p.m. tonight, knowledge empowerment phase 2 live broadcast - control panel interface design of openharmony smart home project
Deep learning - (2) several common loss functions
Rongsheng biology rushes to the scientific innovation board: it plans to raise 1.25 billion yuan, with an annual revenue of 260million yuan
Mysql8.0 method and steps for enabling remote connection permission
[activity registration] it's your turn to explore the yuan universe! I will be waiting for you in Shenzhen on July 2!
观测云与 TDengine 达成深度合作,优化企业上云体验
halcon知识:区域专题【07】
Two methods for MySQL to open remote connection permission
猎头5万挖我去VC
随机推荐
19:00 p.m. tonight, knowledge empowerment phase 2 live broadcast - control panel interface design of openharmony smart home project
Additional: (not written yet, don't look at ~ ~ ~) webmvcconfigurer interface;
备战数学建模33-灰色预测模型2
register_chrdev和cdev_init cdev_add用法区别
赛芯电子冲刺科创板:拟募资6.2亿 实控人谭健为美国籍
Cesium-1.72 learning (add points, lines, cubes, etc.)
JS Es5 can also create constants?
Mathematical modeling for war preparation 34-bp neural network prediction 2
云和恩墨中标天津滨海农村商业银行2022-2023年度Oracle维保项目
KDD 2022 | how far are we from the general pre training recommendation model? Universal sequence representation learning model unisrec for recommender system
Lambda表达式_Stream流_File类
The inspiration from infant cognitive learning may be the key to the next generation of unsupervised machine learning
Niuke: how many different binary search trees are there
牛客网:乘积为正数的最长连续子数组
附加:(还没写,别看~~~)CorsFilter过滤器;
[Verilog quick start of Niuke online question series] ~ bit splitting and operation
halcon知识:区域专题【07】
删除有序数组中的重复项 II[双指针--多情况统一]
招标公告:2022年台州联通Oracle一体机和数据库维保服务项目
POJ Project Summer