Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongoose 如何使用数据库值在Pug中设置内联样式_Mongoose_Pug - Fatal编程技术网

Mongoose 如何使用数据库值在Pug中设置内联样式

Mongoose 如何使用数据库值在Pug中设置内联样式,mongoose,pug,Mongoose,Pug,我试图使用我的数据库值有条件地将样式应用于pug中的一个元素,但它没有按预期工作,我不知道如何修复它 .promo-bar-section.w-clearfix(style='background-color: #{data[0].bgcolor};', data-ix='promo-bar-section-hide') 请尝试以下方法: .promo-bar-section.w-clearfix(style='background-color:' + data[0].bgcolor + ';

我试图使用我的数据库值有条件地将样式应用于pug中的一个元素,但它没有按预期工作,我不知道如何修复它

.promo-bar-section.w-clearfix(style='background-color: #{data[0].bgcolor};', data-ix='promo-bar-section-hide')
请尝试以下方法:

.promo-bar-section.w-clearfix(style='background-color:' + data[0].bgcolor + ';', data-ix='promo-bar-section-hide')