I just want to determine whether a checkbox is checked or not in Vue js 2. In jquery we have functions like $('input[type=checkbox]').prop('checked'); which will return true if checkbox is checked or not. What is the equivalent function in Vue js.
下面是带有代码的场景.请注意,我正在使用laravel及其Blade 模板.
@foreach ($roles as $role)
<input type="checkbox" v-on:click="samplefunction({{$role->id}})" v-model="rolesSelected" value="{{$role->id}}">
@endforeach
js部分是
<script>
var app = new Vue({
el: '#app1',
data: {
rolesSelected:"",
},
methods : {
samplefunction : function(value) {
// Here i want to determine whether this checkbox is checked or not
}
},
});
</script>