v-html
1、案例1
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>v-html</title> </head> <body> <div id="app"> <div v-html="msg1"></div> </div> <script src="../js/vue.js" type="text/javascript"></script> <script> const vm = new Vue({ el: "#app", data: { msg1: "<a href='http://www.baidu.com'>百度</a>" } }); </script> </body> </html>
运行结果:
相识是缘