【发布时间】:2021-08-16 18:34:42
【问题描述】:
我在 Nuxt 中创建了一个博客项目,并在我的数据库中将 quill text editor 用于 description 字段。
从数据库中渲染博客的description 时,我使用了v-html,但我得到了
34:23 警告 'v-html' 指令可能导致 XSS 攻击 vue/no-v-html
<span v-html="blog.description"></span>
为了消除这个警告,我使用了vue-dompurify-html。
<span v-dompurify-html="blog.description"></span>
现在,当我通过 quill 编辑器添加嵌入式视频链接时,dompurify 会在渲染时删除视频。关于如何将其列入白名单的任何想法?
【问题讨论】:
-
视频是什么样的,在你的 DOM 中代替视频链接的最终结果是什么?
-
任何 youtube 视频
-
"description" : "