If I add styles in one page they are applied on all [v0.15]
-
I added a background image in my default
welcome.vue
but now it is displayed on all pages. What should I do to limit the styles of one page to itself only?I found out that after changing the page the background will be kept, but if I then reload in the browser it will go away.
-
you can use the scope attribute on <style> tag
-
More details: https://vue-loader.vuejs.org/en/features/scoped-css.html
-
This is perfectly normal CSS behavior. When you visit a page, its CSS gets loaded (if it has one). Try to use CSS selectors to differentiate different areas of your website/app. Or use the scoped css feature provided by vue-loader on your vue files – but note that it comes with a small price regarding CSS render speed.
-
The scoped css works great, thanks.