当前位置:网站首页>Custom components -- styles
Custom components -- styles
2022-07-28 06:56:00 【Like Feynman%】
1. By default , The style of a custom component is only valid for the current component , Will not affect... Outside the component UI structure , As shown in the figure :
- Components A The style of does not affect the component C The style of
- Components A The style of does not affect the style of the applet page
- The style of the applet page does not affect the component A and C The style of

2. Notes on component style isolation :
- app.wxss The global style in is not valid for the component
- Only class Selectors will have the effect of style isolation ,id Selectors 、 Attribute selector 、 Label selectors are not affected by style isolation
- Suggest : It is recommended to use... In components and pages referencing components class Selectors , Do not use id、 attribute 、 tag chooser
3. Modify style isolation options for components
By default , The style isolation feature of custom components can prevent the problem that the styles inside and outside the components do not interfere with each other , But sometimes , We hope that the outside world can control the internal style of components , here , Can pass styleIsolation Modify style isolation options for components , Usage is as follows
// In the component's .js Add the following configuration in the file
Component({
options:{
styleIsolation:'isolated'
},
styleIsolation Options for :
| Optional box | The default value is | describe |
| isolated | yes | Indicates that style isolation is enabled , Inside and outside of custom components , Use class The specified style will not affect |
| apply-shared | no | Express page wxss Styles will affect custom components , But custom components wxss The specified style will not affect the page |
| shared | no | Show page wxss Styles will affect custom components , Custom components wxss The style specified in will also affect the page and other settings apply-shared or shared The custom component of |
边栏推荐
- HDU-5783 Divide the Sequence(贪心水题)
- Skimming records -- sequence traversal of binary tree
- ---Stack & queue---
- Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking
- HDU-1159-CommonSubsequence(LCS最长公共子序列)
- Wechat applet custom compilation mode
- Technology sharing | how to simulate real use scenarios? Mock technology to help you
- Technology sharing | interface testing value and system
- 软件测试(概念篇)
- 测试面试题集锦(二)| 测试工具篇(附答案)
猜你喜欢

技术分享 | 使用postman发送请求

Si Han talks about the professional development of testers

DNS forward resolution experiment

Technology sharing | send requests using postman

技术分享 | 使用 cURL 发送请求

如何描述一个BUG以及BUG级别的定义、生命周期

Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking

技术分享 | 服务端接口自动化测试, Requests 库的这些功能你了解吗?

NAT和PAT的原理及配置

File operation in C language
随机推荐
What's a good gift for Tanabata? Niche and advanced product gift recommendation
Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking
How to simulate the implementation of strcpy library functions
数组转链表
Centos7 deploy MySQL database server
Ubuntu18.04+Centos7配置redis主从【学习笔记】
SSH服务配置
MySQL常用命令
JS reverse question 100 - question 1
网络——传输层(详细版)
File operation in C language
Array solution script
ISO 3.0-server three power separation configuration
HDU-2036-改革春风吹满地(多边形面积模板)
Create, traverse and search nodes as required for single linked list
Mongo SSL configuration practice
2022 Tanabata gift recommendation! Nice, cheap and practical gift recommendation
JS四则运算重新封装,解决精度丢失问题
Scratch command
遍历 二叉树