如何显示包含模板文字的代码片段? [已关闭]

问题描述 投票:0回答:1
javascript vue.js escaping template-literals
1个回答
1
投票

为什么要逃避?您需要将 ${} 放在模板文字中

let postCont = ref(`
  <code>
    <pre>
      <div
        v-wave="{ color: subTextColor }"
        :style="{
          '--overlay-color': rgba(${ bannerOverlayColor.red },
            ${ bannerOverlayColor.green },
            ${ bannerOverlayColor.blue }, 0.3),
          'border-radius': ${ borderRadius },
          height: ${ bannerHeight },
        }"
      >
      </div>
    </pre>
  </code>
`)
© www.soinside.com 2019 - 2024. All rights reserved.