v-html的弊端?
时间: 2023-10-17 22:01:14 浏览: 123
v-html的弊端主要包括XSS攻击和无法应用scoped样式两个方面。v-html指令可以完全渲染标签节点,这意味着可以将包含恶意代码的HTML字符串插入到页面中,从而导致XSS攻击的风险。例如,当使用v-html将包含恶意代码的字符串插入到页面时,恶意代码可以执行一些危险操作,如获取用户的敏感信息或篡改页面内容。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Vue中v-html使用的安全性问题](https://blog.csdn.net/qq_62858590/article/details/123879916)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [v-html可能导致的问题](https://blog.csdn.net/qq_40413670/article/details/118295470)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文