This commit is contained in:
parent
0d67ac4450
commit
2549b20158
|
@ -1,24 +1,25 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
const $props = defineProps({
|
||||
label: { type: String, default: '' },
|
||||
label: { type: String, default: null },
|
||||
value: {
|
||||
type: [String, Boolean],
|
||||
required: true,
|
||||
default: null,
|
||||
},
|
||||
info: { type: String, default: '' },
|
||||
info: { type: String, default: null },
|
||||
});
|
||||
const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="vn-label-value">
|
||||
<div class="label">
|
||||
<div v-if="$props.label || $slots.label" class="label">
|
||||
<div v-if="!$slots.label">{{ $props.label }}</div>
|
||||
<slot name="label"></slot>
|
||||
</div>
|
||||
<div class="value">
|
||||
<div v-if="$props.value || $slots.value" class="value">
|
||||
<span v-if="isBooleanValue">
|
||||
<QIcon :name="value ? `check` : `close`" :class="value ? `positive` : `negative`" />
|
||||
<QIcon :name="$props.value ? `check` : `close`" :color="$props.value ? `positive` : `negative`" />
|
||||
</span>
|
||||
<span v-else>
|
||||
<slot name="value"></slot>
|
||||
|
@ -26,21 +27,10 @@ const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
|||
</div>
|
||||
<div class="info" v-if="$props.info">
|
||||
<QIcon name="info">
|
||||
<QTooltip class="bg-dark text-white shadow-4" :offset="[10, 10]" square>
|
||||
<QTooltip class="bg-dark text-white shadow-4" :offset="[10, 10]">
|
||||
{{ $props.info }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
@import '../../css/quasar.variables.scss';
|
||||
|
||||
.positive {
|
||||
color: $positive
|
||||
}
|
||||
|
||||
.negative {
|
||||
color: $negative
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue