vhtml 发表于 2019-05-16 | 评论数: 注意这种方法在你无法保证绝对安全时不要使用,否则会造成SSR攻击 12345678910111213141516171819202122232425<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <title>Document</title></head><body> <div id="app"> <span v-html="h2"></span> </div> <script> new Vue({ el:'#app', data:{ h2:'<h2>hello world</h2>' } }) </script> </body></html> 结果: -------------本文结束感谢您的阅读-------------