运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <title>Vue Important Checkbox</title> <style> form { border: dashed black 1px; display: inline-block; padding: 10px; } label { padding: 5px; } label:hover { cursor: pointer; background-color: lightgray; border-radius: 5px; } </style> </head> <body> <h1>Example: Important Checkbox</h1> <p>This 'important' checkbox is a dynamic form feature that will be added to a shoppinglist form later, but we isolate it here first to easier see how it works.</p> <div id="app"> <form> <p> Important item? <label> <input type="checkbox" v-model="important"> {{ important }} </label> </p> </form> </div> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> <script> const app = Vue.createApp({ data() { return { important: false } } }) app.mount('#app') </script> </body> </html>