How do I insert html tags in JS with pug?

前端 未结 1 906
南笙
南笙 2021-01-22 12:03

When I need to use a JSON-like object in JS with different data in each block and iterating through that object I make a HTML code via pug.

Let me describe it in code<

相关标签:
1条回答
  • 2021-01-22 12:22

    You can write the html tags as usually something like:

    text: "wake up and <span class='color-red brush'>some teeth</span>"

    Then in pug you can use unescaped attributes like this:

    .some-class!=footerMenu.left[0].text
    

    or using string interpolation attributes unescaped

    .some-class !{footerMenu.left[0].text}
    
    0 讨论(0)
提交回复
热议问题