[Vuejs]-How can I add style to the components?

0👍

You should manage the component style in their own <style>, and you pass the class in your parent component:

Give you a example.

In you parent component pass the class:

<template>
  <div class="home">
    <banner></banner>
    <div class="functions">
      <function-intro :class="'inline-block'"></function-intro>
      <function-intro :class="'inline-block'"></function-intro>
      <function-intro :class="'inline-block'"></function-intro>
      <function-intro :class="'inline-block'"></function-intro>
    </div>

  </div>
</template>

in the child component(there is the FunctionIntro component) style:

.inline-block {
  display: inline-block;
}

Leave a comment