Created
March 6, 2024 09:53
-
-
Save gibrandev/1cb3d46eec48356bda9cbd90f8469c27 to your computer and use it in GitHub Desktop.
Switch button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup> | |
const check = reactive({ | |
input: [ | |
true, | |
false | |
] | |
}) | |
const changeCheckbox = (e, i) => { | |
console.log(e.target.checked); | |
check.input[i] = e.target.checked | |
} | |
</script> | |
<template> | |
<div class="p-10" v-for="(item, i) in check.input"> | |
<div>{{ item === true ? 'Yes' : 'No'}}</div> | |
<input type="checkbox" @change="e => changeCheckbox(e, i)"/> <input :disabled="item" class="disabled:bg-red-900" /> | |
</div> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment