css - 车把内联css
问题描述
我想使用把手传递像 style="background-color: value" 这样的内联 css。
我有js文件
module.exports = {
header: 'some title',
boxes: ["here some objects"],
style: {
backgroundCol: '#000',
textCol: '#f00',
numbersCol: '#c31d5a',
titleSize: '28px',
numbersSize: '42px',
}
}
我使用#each 循环来获取所有框,并希望通过这些样式来设置它们的样式。我试图以这种方式做到这一点:
<div class="test" style="background-color: '{{style.backgroundCol}}'">
使用内联样式的正确方法是什么,或者有什么方法可以将此“样式”对象传递给样式表并使用类?
解决方案
推荐阅读
- php - 是什么导致标题功能没有在我的登录页面上重定向?
- kubernetes - 在子路径上使用 Kubernetes NGINX 入口控制器公开应用程序,而不控制应用程序的基本路径
- python - 无法使用从另一个类获取的 url 从 crawlspider 类中抓取数据
- mysql - 如何使用 Node 从 MySQL 数据库中获取数据
- python - 简单Flask python后端中POST方法的KeyError
- java - 如何从字符串中解析时间?
- python - 带有 seaborn 的 Matplotlib 不显示西里尔符号
- eclipse - Eclipse 2019 黑色背景
- java - 如何从第二个位置删除一个线性布局子?
- android - 一旦登录成功,Android 初始登录屏幕然后使用片段在屏幕之间滑动