javascript - 有没有办法让 Pug 将 JavaScript 变量解释为 HTML 代码?
问题描述
解决方案
A better way to write this would be—</p>
- var starNumber = review.rating * 10
span
strong Rating
| : #{review.rating}
span.stars-container(class=`stars-${starNumber}`) *****
—which should compile to what you're looking for if I'm understanding your approach correctly.
推荐阅读
- php - 获取作者在空间分类中的帖子
- apache - .htaccess 将查询字符串重写为路径 url
- android - 房间数据库不更新值
- build - 工艺,关于建设 Kdenlive
- javascript - Lodash 用条件合并两个数组
- python - 简单的列表程序不起作用 - 列表索引超出范围错误
- python - 未知标签类型:“连续”sklearn LogisticRegression
- java - 通过 Java 应用程序创建的 Csv 文件中的可点击电子邮件链接
- php - 在 Laravel Dom PDF 视图中,Table>td 内容显示不正确。如何将剩余内容放到底部或下一页?
- angular - 如何在角管道中异步设置变量?