【问题标题】:Vue.js renders code inside braces literally - shows braces instead of the resultVue.js 从字面上呈现大括号内的代码 - 显示大括号而不是结果
【发布时间】:2018-09-19 08:20:10
【问题描述】:

这是我的<template> 代码:

<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

呈现如下:

如您所见,不是计算括号内的第二个表达式,而是按字面呈现,而第一个表达式工作正常。

我做错了什么?

【问题讨论】:

    标签: vue.js


    【解决方案1】:

    试试这个:

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

    您能否发布运行代码时出现的控制台错误?

    【讨论】:

    • 控制台上实际上什么都没有
    猜你喜欢
    • 1970-01-01
    • 2017-05-26
    • 1970-01-01
    • 2021-04-27
    • 2017-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多