Sharing Vue component
Opened this issue · 0 comments
vcmirko commented
You must add the scss file where you load the original sass. Would be great if you could add this to package.
<template>
<span>
<input type="checkbox" :id="_uid" class="switch" :class="type" :value="val" v-model="checked">
<label :for="_uid"> {{ label }}</label>
</span>
</template>
<script>
import Vue from 'vue'
import BulmaSwitch from "bulma-switch"
import "../../public/assets/bulma_switch.scss"
export default{
name:"BulmaSwitch",
props: ['type','value', 'val','label'],
data () {
return {
}
},
computed: {
checked: {
get() {
return this.value
},
set(value) {
this.$emit('input', value)
}
}
}
}
</script>
Usage in vue:
<div class="control mb-2">
<BulmaSwitch v-model="myBooleanVariable" type="is-rounded is-warning" label="Your label" />
</div>