【vue】v-text,v-html渲染数据

时间:2024-04-13 08:45:49
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div id="app"> <h2>{{web.title}}</h2> <h2 v-text="web.title"></h2> <h2 v-text="web.url"></h2> <h2 v-html="web.url"></h2> </div> <script type="module"> import { createApp, reactive } from './vue.esm-browser.js' createApp({ setup() { const web = reactive({ title: "tao355667", url: "<i style='color:blue'>www.tao355667.com</i>" }) return { web } } }).mount("#app") </script> </body> </html>