adrema/resources/js/components/VBool.vue

33 lines
723 B
Vue
Raw Normal View History

2021-04-11 02:55:26 +02:00
<template>
2022-08-29 12:03:11 +02:00
<div class="bool" v-tooltip="comment" :class="value ? 'enabled' : 'disabled'">
2022-02-12 15:22:22 +01:00
<svg-sprite v-if="!$slots.default" :src="value ? 'check' : 'close'"></svg-sprite>
2021-07-04 18:20:09 +02:00
<slot></slot>
2021-04-11 02:55:26 +02:00
</div>
</template>
<script>
export default {
props: {
2022-08-29 12:03:11 +02:00
value: {},
trueComment: {},
falseComment: {},
2021-04-11 02:55:26 +02:00
},
computed: {
t() {
return this.value ? 'Ja' : 'Nein';
2022-08-29 12:03:11 +02:00
},
comment() {
if (this.value && this.trueComment) {
return this.trueComment;
}
if (!this.value && this.falseComment) {
return this.falseComment;
}
return '';
},
},
2021-04-11 02:55:26 +02:00
};
</script>