vue 页面显示神器 v-html

最近自己开发一套客服系统,需要打通微信及H5。在做微信基本表情时无意中发现vue中一直被忽视的标签v-html。
v-html 标签的作用是显示动态数据中的H5标签
示例:

<template>
  <view v-html="test">{{test}}</view>
</template>
<script>  
export default { 
  data () {
    return {
      test:'我是一个表情<image src="https://btsstatic.oss-cn-shanghai.aliyuncs.com/admin/emoji/100.gif" width="24" height="24"></image>'
    }
  }
}
</script>

然后,界面显示

在这里插入图片描述

发布了24 篇原创文章 · 获赞 11 · 访问量 5415

猜你喜欢

转载自blog.csdn.net/weixin_44037376/article/details/98948442