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