There is a difference in the access style between the development of vue local startup service and the access style after code compression.

if the styles I wrote in a component when I was developing locally, some of the styles in the component will affect the global or other page styles if they are compressed and viewed online. Is there a solution

Oct.19,2021

  • to use css module, is to add scoped to the style tag.
  • each component has a unique class, and then all the styles of the component are hung under this class, such as
.box{
  xxx:xxx
}
.box .header{ }
.box .footer{ }
...

does the style tag of the vue file add the scope of the scoped declaration

 

1, css modules

2, declaration style scope: 1) each component has a wrap ; 2) < style scoped > tag

Menu