Answer the question
In order to leave comments, you need to log in
scss variable from view to component?
Hello I have Vue 3 component
<template>
<div class="block">test for red color</div>
</template>
<script>
export default {
name: "HelloWorld",
};
</script>
<style lang="scss">
.block {
color: $color-text;
}
</style>
<template>
<div class="home">
<HelloWorld />
</div>
</template>
<script>
import HelloWorld from "@/components/HelloWorld.vue";
export default {
name: "Home",
components: {
HelloWorld,
},
};
</script>
<style scoped lang="scss">
$color-text: red;
</style>
Answer the question
In order to leave comments, you need to log in
No. Variables need to be placed in a separate file and imported in the places you need.
VueJS: where is the best place to store css, in .vue components or main.css?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question