运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <title>v-text Directive</title> <style> #app > p { border: dashed black 1px; width: 200px; padding: 20px; font-weight: bold; background-color: lightgreen; } </style> </head> <body> <h1>Example 'v-text'</h1> <p>Using the 'v-text' directive to put text inside a p-tag. The existing text is replaced with the new text.</p> <div id="app"> <p v-text="pText">Old text.</p> </div> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> <script> const app = Vue.createApp({ data() { return { pText: 'This is the new text!' } } }) app.mount('#app') </script> </body> </html>