adrema/resources/js/components/ui/Bool.vue

36 lines
791 B
Vue
Raw Normal View History

2021-04-11 02:55:26 +02:00
<template>
2023-09-06 23:40:14 +02:00
<div v-tooltip="comment" class="bool" :class="value ? 'enabled' : 'disabled'">
<ui-sprite v-if="!$slots.default" :src="value ? 'check' : 'close'"></ui-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: {
2023-09-06 23:40:14 +02:00
value: {
type: Boolean,
default: () => false,
},
2022-08-29 12:03:11 +02:00
trueComment: {},
falseComment: {},
2021-04-11 02:55:26 +02:00
},
computed: {
t() {
2023-09-06 23:40:14 +02:00
return this.value ? 'Ja' : 'Nein';
2022-08-29 12:03:11 +02:00
},
comment() {
2023-09-06 23:40:14 +02:00
if (this.value && this.trueComment) {
2022-08-29 12:03:11 +02:00
return this.trueComment;
}
2023-09-06 23:40:14 +02:00
if (!this.value && this.falseComment) {
2022-08-29 12:03:11 +02:00
return this.falseComment;
}
return '';
},
},
2021-04-11 02:55:26 +02:00
};
</script>