0

I want to add a CSS to bootstrap vue table template but it doesn't work

<template slot="actions" slot-scope="data" :style="{min-width:'150px'}">
    <b-button variant="info" @click="showViewModel(data.item)">
       <i class="fa fa-eye"></i>
    </b-button>
   <b-button variant="danger" class="ml-1" @click="showConfirmBox(data.item.id,data.index)">
       <i class="fa fa-trash"></i>
   </b-button>
</template>

2 Answers 2

1
 <template slot="actions" slot-scope="data">
    <div :style="'min-width:150px'">
      <b-button variant="info" @click="showViewModel(data.item)">
         <i class="fa fa-eye"></i>
      </b-button>
      <b-button variant="danger" class="ml-1" @click="showConfirmBox(data.item.id,data.index)">
       <i class="fa fa-trash"></i>
      </b-button>
    </div>
  </template>
Sign up to request clarification or add additional context in comments.

1 Comment

Any reason you're binding your style instead of just style="min-width: 150px" ?
0

Vue's template tag renders into nothing, so adding style to it has no effect.

Also, adding style with Vue you should use plain strings instead of objects. So instead of this:

:style="{min-width:'150px'}"

Use this:

:style="'min-width:150px'"

3 Comments

@S.Gandhi it'll never work with <template>, it doesn't render into anything. Replace it with a real tag like <div>
its is necessary for custom data rendering so I can not remove it
@S.Gandhi then add a div immediately inside the template and move the style to it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.