首页 > 解决方案 > 有没有办法让 Pug 将 JavaScript 变量解释为 HTML 代码?

问题描述

标签: javascriptpug

解决方案


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.


推荐阅读