我有可变的对象数组,其中一个包含字符串中的元素p。我想附加到元素div.profile-description
但结果是 vue js 返回原始 html 到div.profile-description
我想将字符串中的 p变成html 中的元素
var interviewees = [
{name: 'Anthony', profession: 'Developer', description: '<p>Now he works in one</p><p>very famous company</p>'},
{name: 'Erick', profession: 'Gamer', description: '<p>He is focusing on playing</p><p>the heroes of the storm game</p>'}
];
var setDescription = new Vue({
el: '.profile-description',
data: {
interviewee_description: interviewees[1].description
}
});Run Code Online (Sandbox Code Playgroud)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.0/vue.js"></script>
<div class="profile-description">
{{ interviewee_description }}
</div>Run Code Online (Sandbox Code Playgroud)