I
I
Iliaity2019-03-18 18:31:39
Vue.js
Iliaity, 2019-03-18 18:31:39

What is the correct way to style the component?

There is a universal component <Avatar/> and I need to indent the right 10px.
I have 2 options:
1) Through style <Avatar :style="margin-right: 10px"/> - in this option, the code turns out to be dirty
2) Through a wrapper <div class="container-avatar"><Avatar/></div>- in this option, an extra html element
What are the best practices for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-03-18
@Iliaity

Through a wrapper <div class="container-avatar"><Avatar/></div>- in this version, an extra html element

What's stopping you from adding a class directly to a component instance? Quite a working option .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question