Vue.js renders code inside braces literally - shows braces instead of the result

时间:2018-09-19 08:20:10

标签: vue.js

This is my <template> code:

<div class="message-details pull-right small" style="display: none;">
  <strong>Intent:</strong> {{ message.intent }} ({{ (message.confidence * 100).toFixed(2) + '%' }})
  <br>
  <strong>Entities:</strong>
  {{ message.entities.map(e => `${e.type} = ${e.value}`).join('<br>') }}
  ...
  other stuff

It renders as follows:

enter image description here

As you can see, instead of computing the second expression inside the brackets, it is rendered literally, while the first expression works fine.

What am I doing wrong?

1 个答案:

答案 0 :(得分:0)

尝试一下:

{{ message.entities.map(e => e.type = e.value).join('\r\n') }}

并且您可以发布运行代码时出现的控制台错误吗?