我写了以下代码:<template v-slot="scope"> <div :class="getFuncationBarClass(scope)" :style="'{ --progress: `${getFunctionPercentage(scope)}` }'">{{getFuncationTotals(scope)}}</div></template>由于某种原因getFuncationBarClass,getFuncationTotals被调用但getFunctionPercentage未被调用。我尝试了其他一些变体,:style但都没有用。如何从样式绑定中调用方法?
1 回答
蛊毒传说
TA贡献1895条经验 获得超3个赞
在 Vue 中你可以直接传递样式对象。你可以试试:
<div :class="getFuncationBarClass(scope)" :style="{ '--progress': getFunctionPercentage(scope) }">{{getFuncationTotals(scope)}}</div>添加回答
举报
0/150
提交
取消
