when using css module, the parent component suffixes the class selector of the child component style with the hash suffix, but the html tag is intact, causing the child component to reference no style effect
for example, btn.vue
is referenced in header.vue
.
Sub-component set .class {background:red}
in dom: class= "$style.class"
.
becomes
after compilation style is: .class _?
(hash suffix),
dom is: class= "class"
.
the two do not match, so the style cannot take effect.
refer to the question page