D
D
Denoro552019-01-24 19:17:07
Vue.js
Denoro55, 2019-01-24 19:17:07

What are the ways to solve the styling and routing problem in Vue.js?

Let's say there is a main page / and a blog /blog
, I went to the main page, styles were applied to it, here is the structure of the main template like this: App.vue

<template><template>
<script><script>
<style>
body: text-align: center;
<style>

The problem is that if you go from the main page to the blog, then the styles will be applied there as well
. But if you update /blog, then there will be no styles anymore.
It turns out that you need to connect styles to the entire site in general? Is this one of the solutions? Or it is possible all the same to each component somehow to make?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2019-01-24
@Denoro55

scoped

I
in some, 2019-01-25
@iGanza

scoped styles are not a good selector performance solution, + almost always result in noodle css.
describe styles locally using BEM or css-modules and include them in a component, get isolation and good performance.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question