当前位置:网站首页>Wechat applet basic learning (wxss)
Wechat applet basic learning (wxss)
2022-07-02 23:32:00 【Jenny_ Ghost】
WXSS (WeiXin Style Sheets) It's a style language , Used to describe WXML Component style .
WXSS Used to decide WXML How should components of .
And CSS comparison ,WXSS The extended features are : Unit size and style import
One 、 Writing position
1.1 inline style
<text style="background-color: aqua;font-size: 20px;"> inline style </text>
1.2 Page style
Written in .wxss In file
.wxsstest01{
height: 30px;
width: 200px;
background-color: rgba(146, 146, 236, 0.692);
font-size: 30px;
}1.3 Global style
Global style is written in app.wxss in , The style is global On the page They can be used directly , But it cannot be applied to components
1.4 priority
inline > On page > overall situation ;
Can pass !important To increase priorities
1.5wxss Import of
Use @import You can import other wxss The style file
Two 、wxss Unit of size of
rpx(responsive pixel): You can adapt to the width of the screen . Set the screen width to 750rpx. If in iPhone6 On , The screen width is 375px, share 750 Individual physical pixels , be 750rpx = 375px = 750 Physical pixel ,1rpx = 0.5px = 1 Physical pixel .
3、 ... and 、 Selectors

Four 、flex Layout
wxss Medium flex Layout and css Of flex The layout is the same , You can look forward CSS Medium flex Layout to learn
5、 ... and 、 Style base library
When using the style base library , You need to change the page structure 、 Page style (style in )、 Copy the page logic
Application components should be in .json Declare the component path in the file .
6、 ... and 、 Components
You can see more detailed component contents in the official documents of wechat
6.1view Components
view A component is a block level element , The default effect is arranged vertically
view Some properties of the component 
hover-stop-propagation You need to use double braces to write true and false
<view hover-class="tap" hover-start-time="0" hover-stay-time="0" hover-stop-propagation="{
{true}}">111</view>6.2text Components
text Components can only be nested inside text Components , You can't change the size freely without exclusive row , But it can go through display Property to modify
text Some properties of

decode Combined with space escape character
<text space="emsp" selectable="{
{true}}">1 1 1</text>
<text space="ensp">1 1 1</text>
<text space="nbsp">1 1 1</text>
<text decode="{
{true}}">1 1</text>
The blue part is selected
6.3image Components

mode The legal value of 
Use it directly src To import local pictures
6.4icon Components
type The valid values of can only be :
success, success_no_circle, info, warn, waiting, cancel, download, search, clear
adopt color You can directly change the color of the icon
6.5button Components
button Components are generally used to receive user clicks to perform different logic
button Properties of :
①size The property value is default Default size and mini Small size
②type Attribute is the style of the button , The property value is default white ,primary green ,warn Three colors of red 3
③plain Attribute indicates hollowed out effect , The following figure shows the hollowed out effect

④loading Attribute will display the icon of loading style in front of the button 
⑤from-type be used for from Components , Clicking on the respective will trigger form Component's submit( Submit Form )/reset( Reset form ) event



6.6swiper+swiper-item
swiper Refers to the slider trying to container , Only place swiper-item Components , Otherwise, it will lead to undefined behavior , It is often used in the carousel .
swiper Not used alone , Only in swiper Nested in tags swiper-item The content will be displayed after the label .

The following code is a simple rotation diagram ,WXSS The code is not released separately , Using the following code directly, the image will be stretched , The default value of the property is true when , Don't write { {true}}.
Through to image The label binding click event can realize the jump effect when clicking on the image
<swiper class="lbt"
indicator-dots="{
{true}}"
indicator-color="white"
indicator-active-color="blue"
autoplay="{
{true}}"
interval="3000"
circular>
<swiper-item>
<image src="https://i0.hdslb.com/bfs/archive/[email protected]_378h_1c.webp" class="image"></image>
</swiper-item>
<swiper-item>
<image src="https://i2.hdslb.com/bfs/archive/[email protected]_378h_1c.webp" class="image"></image>
</swiper-item>
</swiper>The effect of the rotation map
6.6.1 Jump effect :
stay .js Use... In the document wx.navigateTo({url:'UUURRRLLL'}) Realize page Jump , After the jump , In the jump page, you can get the attribute value of the object clicked during the jump .
_handleTap:function(){
wx.navigateTo({
url: '/page/1-view/1-view',
})
},边栏推荐
- 程序员版本的八荣八耻~
- Third party payment function test point [Hangzhou multi tester _ Wang Sir] [Hangzhou multi tester]
- Highly available cluster (HAC)
- BBR 遭遇 CUBIC
- Arduino - character judgment function
- RuntimeError: no valid convolution algorithms available in CuDNN
- Call vs2015 with MATLAB to compile vs Project
- C# MVC创建一个视图摆脱布局的影响
- C#中Linq用法汇集
- Bean加载控制
猜你喜欢

购买完域名之后能干什么事儿?

Where is the win11 microphone test? Win11 method of testing microphone

基于Pyqt5工具栏按钮可实现界面切换-1

CDN 加速,需要域名先备案

Is 408 not fragrant? The number of universities taking the 408 examination this year has basically not increased!

为什么RTOS系统要使用MPU?

海思 VI接入视频流程

Pandora IOT development board learning (HAL Library) - Experiment 4 serial port communication experiment (learning notes)

【ML】李宏毅三:梯度下降&分类(高斯分布)

CDN acceleration requires the domain name to be filed first
随机推荐
VIM interval deletion note
Prometheus deployment
Mapper代理开发
Cryptographic technology -- key and ssl/tls
理想汽车×OceanBase:当造车新势力遇上数据库新势力
Win11如何开启目视控制?Win11开启目视控制的方法
富滇银行完成数字化升级|OceanBase数据库助力布局分布式架构中台
SharedPreferences 保存List<Bean> 到本地并解决com.google.gson.internal.LinkedTreeMap cannot be cast to异常
Makefile configuration of Hisilicon calling interface
php 获取真实ip
Arduino - character judgment function
非路由组件之头部组件和底部组件书写
Potplayer set minimized shortcut keys
Three solutions to frequent sticking and no response of explorer in win11 system
Win11自动关机设置在哪?Win11设置自动关机的两种方法
C# MVC创建一个视图摆脱布局的影响
程序员版本的八荣八耻~
Agnosticism and practice makes perfect
数字图像处理实验目录
Arduino - 字符判断函数
