style scopedThings to note:
1. Deep selector: can affect child components. Use pseudo class => :deep(cls: affected selector) .a :deep(.b) { ... } 2. Slot selector: can affect the style of the slot content. Use pseudo-class => :slotted(selector) :slloted(.a) { ... } 3. Global selector: The style affects the global environment. Using pseudo-class => :global(selector) :slloted(.a) { ... } scoped style can exist with style style moduleThe style tag contains a module. Its style, like style scoped, can only be scoped to the current component. This method compiles CSS into CSS modules and exposes them to the component $styles object to use CSS styles. <template> <p :class="$style.red"> This should be red </p> </template> <style module> .red { color: red; } </style> You can assign values to the module to customize the name of the exposed object <template> <p :class="style.red"> This should be red </p> </template> <style module='style'> .red { color: red; } </style> You can use the useCssModule() api to use cssModule in the combined api. // By default, returns the class in <style module> useCssModule() // Naming, returning the class in <style module="classes"> useCssModule('classes') State-driven dynamic CSSYou can use v-bind() to associate CSS values with dynamic component states. <template> <div class="text">hello</div> </template> <script> export default { data() { return { color: 'red' } } } </script> <style> .text { color: v-bind(color); } </style> SummarizeThis is the end of this article about the style feature in vue3 single-file components. For more relevant vue3 single-file component style feature content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: MySQL 8.0.20 installation and configuration method graphic tutorial under Windows 10
>>: How to add shortcut commands in Xshell
As a software developer, you must have a complete...
Preface The default database file of the MySQL da...
Sometimes the theme of a project cannot satisfy e...
Many times when learning web page development, th...
What is the nobody user in Unix/Linux systems? 1....
Table of contents 1. Description 2. Download rela...
Table of contents 1. Teleport usage 2. Complete t...
Table of contents 1. React.FC<> 2. class xx...
The key features of the InnoDB storage engine inc...
Table of contents Nginx load balancing configurat...
Table of contents 1. The original array will be m...
In design work, I often hear designers participati...
Greek letters are a very commonly used series of ...
What is an inode? To understand inode, we must st...
Table of contents Tutorial Series 1. User Managem...