Answer the question
In order to leave comments, you need to log in
How to name classes in vue components?
How to write classes in vue components correctly? With component name prefix? (meaning best practice)
Option 1:
// TodoItem.vue
<template>
<div class="todo-item">
<div class="todo-item-left">...</div>
<div class="todo-item-button">...</div>
</div>
</template>
// TodoItem.vue
<template>
<div class="todo-item">
<div class="left">...</div>
<div class="button">...</div>
</div>
</template>
// TodoItem.vue
<template>
<div class="todo-item">
<div class="todo-item__left">...</div>
<div class="todo-item__button">...</div>
</div>
</template>
// Title.vue
<template>
<div class="title">Заголовок</div>
</template>
// Home.vue
<template>
<div class="home">
<Title/> // Конфликт c class="title"
....
<div class="title"></div>
</div>
</template>
Answer the question
In order to leave comments, you need to log in
Try the second option if you like, but add scoped in the component
In theory, the styles will not overlap
<style scoped>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question