属性内的Vue.js原始HTML

Jac*_*yke 5 vue.js vuejs2

有没有一种方法可以将原始HTML输出到标签属性而不是内容?

例:

<input :placeholder="data.raw-html-message"/>

...

data.raw-html-message = "some text&hellip;"
Run Code Online (Sandbox Code Playgroud)

v-html 似乎仅将其输出到标记的innerHTML中,并且在版本2中删除了三重花括号。

当前使用标准v-bind,输出为:

<input placeholder="Message&hellip;" />

并且在浏览器中显示HTML实体时不会对其进行解释。

此处的示例:https : //jsfiddle.net/cdsm22q8/1/

El *_*elo -1

为什么不用自己的函数来解析它呢?

function parse_entities(string){
  return unescape(string);
}
Run Code Online (Sandbox Code Playgroud)

https://jsfiddle.net/t8v7cre1/