v-text: escape output
v-html: not escape output
It is worth saying that if the direct use {{html}}, then escape directly
Look at the code:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>vue.js 使用 v-text 和 v-html </title> <script src="vue.js"></script> </head> <style> </style> <body> <div id="ask"><!- ->VUE can not control the body and html tag < Div V-HTML = "HTML" > </ div > <-! Not escape output -> < Div V-text = "HTML" > </ div > <! - escape output -> </ div > < Script > var App = new new Vue ({ // instantiate VUE EL: ' #ask ' , // VUE ask the control of the element id, Data: { title:'ask.mykeji.net', html:'<h1 style="color: red">mykeji</h1>' } }); </script> </body> </html>