Answer the question
In order to leave comments, you need to log in
How to make checkbox return '0' or '1' in VUE?
Hello,
I have 0 or 1 in a column in my database, I want the checkbox to give such results, and it is NULL or on.
Thank you!
<template>
<div>
<input type="checkbox" name="coworker" v-bind:true-value="1" v-bind:false-value="0" v-model="coworker">
<label for="checkbox">{{coworker}}</label>
</div>
</template>
export default {
props: ['user'],
data: function () {
var user = JSON.parse(this.user);
return {
coworker: user[0].coworker
}
},
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question