screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <div id="app"> <h3>Vue checkbox change event value</h3> <input type="checkbox" id="myCheckbox" v-model="isChecked" @change="handleCheckboxChange"> <label for="myCheckbox">My Checkbox</label> <P v-if="result">Output: {{result}}</P> </div> <script type="module"> const app = Vue.createApp({ data() { return { isChecked: false, result: null } }, methods: { handleCheckboxChange() { this.result = `Checkbox is now ${this.isChecked ? 'checked' : 'unchecked'}` } } }); app.mount('#app'); </script> <style scoped> #app { display: flex; flex-direction: column; align-items: center; margin: 20px; } label { font-size: 16px; font-weight: bold; margin-right: 10px; } input[type="checkbox"] { height: 20px; width: 20px; margin-right: 10px; } p { font-size: 18px; margin-top: 10px; } </style> </body> </html>