不间断空格在 vue 模板中呈现为常规空格

pet*_*lko 4 html javascript vue.js vuejs2

当我 在 Vue 模板中使用时,在浏览器中它们被呈现为常规空间。

<template>
  <p>
     sample text in&nbsp;sample text 
     <strong>lorem ipsum</strong>
   </p>
</template>
Run Code Online (Sandbox Code Playgroud)

浏览器中的最终渲染如下所示:

示例文本中的示例文本lorem ipsum

我的问题是如何在模板中编写不间断空格?

小智 7

<p>
 sample text in{{'\xa0'}}sample text 
 <strong>lorem ipsum</strong>
<p>
Run Code Online (Sandbox Code Playgroud)

尝试使用 JavaScript 转义码而不是 HTML 实体。