Skip to content

vue/no-v-html

禁止使用 v-html 来防止 XSS 攻击

  • ⚙️ 此规则包含在 "plugin:vue/recommended"*.configs["flat/recommended"]"plugin:vue/vue2-recommended"*.configs["flat/vue2-recommended"] 中。

📖 规则详情

此规则报告 v-html 指令的所有使用情况,以降低将潜在的不安全/未转义的 html 注入浏览器导致跨站点脚本 (XSS) 攻击的风险。

¥This rule reports all uses of v-html directive in order to reduce the risk of injecting potentially unsafe / unescaped html into the browser leading to Cross-Site Scripting (XSS) attacks.

Now loading...

🔧选项

¥🔧 Options

无。

¥Nothing.

🔇何时不使用

¥🔇 When Not To Use It

如果你确定传递给 v-html 的内容是经过清理的 HTML,则可以禁用此规则。

¥If you are certain the content passed to v-html is sanitized HTML you can disable this rule.

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v4.7.0 中引入

¥This rule was introduced in eslint-plugin-vue v4.7.0

🔍代码实现

¥🔍 Implementation

eslint-plugin-vue v10.0 中文网 - 粤ICP备13048890号