【发布时间】:2019-10-17 12:00:18
【问题描述】:
我需要为我的<b-col /> 元素添加自定义样式,如下所示:
<b-container fluid class="bootstrap-container">
<b-row id="plan-execution">
<b-col :style="executionProgress" >Hello!</b-col>
</b-row>
</b-container>
在executionProgress 变量中,它存储了我之前计算的样式,例如:
background: linear-gradient(to right, rgba(0, 255, 0, 0.2) 0% , rgba(0, 255, 0, 0.2) 55.00%, rgba(0, 255, 0, 0.0) 57.00%) no-repeat
(样式根据从API收集的数据计算)
我试过了::style="",v-bind:style="",但没有效果。
在下面的代码中,绑定样式完美
<table class="sah-table">
<tr id="plan-execution">
<td :style="executionProgress">Hello!</span></td>
</tr>
<table>
小问题:如何将之前填充的样式绑定到 <b-col /> 元素?
【问题讨论】:
-
你能提供一个runnable minimal reproducible example吗?乍一看,
executionProgress似乎不是你应用时所想的那样。 -
我忘了添加计算
executionProgress变量的函数
标签: css twitter-bootstrap vue.js