版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_15253407/article/details/88716189
<template>
<transition name="el-notification-fade">
<div
:class="['el-notification', customClass, horizontalClass]"
v-show="visible"
:style="positionStyle"
@mouseenter="clearTimer()"
@mouseleave="startTimer()"
@click="click"
role="alert"
>
<i
class="el-notification__icon"
:class="[ typeClass, iconClass ]"
v-if="type || iconClass">
</i>
<div class="el-notification__group" :class="{ 'is-with-icon': typeClass || iconClass }">
<h2 class="el-notification__title" v-text="title"></h2>
<div class="el-notification__content" v-show="message">
<slot>
<p v-if="!dangerouslyUseHTMLString">{{ message }}</p>
<p v-else v-html="message"></p>
</slot>
</div>
<div
class="el-notification__closeBtn el-icon-close"
v-if="showClose"
@click.stop="close"></div>
</div>
</div>
</transition>
</template>
1. {{ text }} // 将数据解析成为纯文本,不能显示输出 HTML
2. v-html // 可以渲染输出html
3. v-text="text":将数据解析为纯文本,不能输出真正的html,与花括号的区别是在页面加载时不显示{{}}