运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <title>My first Vue page</title> <style> div { margin: 10px; padding: 10px; border: solid black 1px; display: inline-block; } .pinkBG{ background-color: lightpink; } </style> </head> <body> <h1>'v-bind' Example</h1> <p>The browser finds the class name inside the Vue instance.</p> <div id="app"> <p>Everything inside the div emelent with id="app" can use data from the Vue instance.</p> <div v-bind:class="vueClass">This element is bound to the "pinkBG" class.</div> </div> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> <script> const app = Vue.createApp({ data() { return { vueClass: "pinkBG" } } }) app.mount('#app') </script> </body> </html>