yoa*_*azz 3 html vue.js nuxt.js
我在我的组件中传递的对象内部收到一个正文(actu.body),里面有 html 标签(主要是 p 标签),我想知道如何为客户端解释它们,我的代码现在是这样的:
<template>
<div>
<!-- {{ actu }} -->
<v-parallax
:src="actu.images[0].url"
dark
>
<v-layout
align-center
column
justify-center
>
<h1 class="display-2 font-weight-thin mb-3">{{ actu.headline }}</h1>
<h4 class="subheading">{{ actu.summarry }}</h4>
</v-layout>
</v-parallax>
<v-card>
<v-card-text>
{{ actu.body }}
</v-card-text>
</v-card>
</div>
</template>
<script>
export default {
props: {
actu: {
type: Object,
required: true
}
Run Code Online (Sandbox Code Playgroud)
} };
有没有正确的方法可以用 vue js 做到这一点?
看看官方指南:https : //vuejs.org/v2/guide/syntax.html#Raw-HTML
诀窍是 v-html 指令
<span v-html="rawHtml"></span>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5982 次 |
| 最近记录: |