init crater

This commit is contained in:
Mohit Panjwani
2019-11-11 12:16:00 +05:30
commit bdf2ba51d6
668 changed files with 158503 additions and 0 deletions

View File

@ -0,0 +1,66 @@
<template>
<div class="base-switch">
<input
:id="uniqueId"
v-model="checkValue"
type="checkbox"
@input="handleInput"
@change="handleChange"
@keyup="handleKeyupEnter"
@blur="handleFocusOut"
>
<label class="switch-label" :for="uniqueId"/>
</div>
</template>
<script>
export default {
props: {
value: {
type: Boolean,
required: false,
default: false
},
disabled: {
type: Boolean,
required: false,
default: false
}
},
data () {
return {
id: null,
checkValue: this.value
}
},
computed: {
uniqueId () {
return '_' + Math.random().toString(36).substr(2, 9)
}
},
watch: {
'value' () {
this.checkValue = this.value
}
},
methods: {
handleInput (e) {
this.$emit('input', e.target.checked)
},
handleChange (e) {
this.$emit('change', this.checkValue)
},
handleKeyupEnter (e) {
this.$emit('keyup', this.checkValue)
},
handleFocusOut (e) {
this.$emit('blur', this.checkValue)
}
}
}
</script>
<style scoped>
/* .switch-label {
margin-bottom: 3px !important
} */
</style>