<template>
|
<div class="data-board-card-price">
|
<div class="data-board-card-value">{{ displayValue }}</div>
|
<div class="data-board-card-unit">{{ unit }}</div>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import { toThousand } from '@/utils';
|
|
defineOptions({
|
name: 'DataBoardCardPrice',
|
});
|
|
type Props = {
|
value?: number;
|
useThousand?: boolean;
|
unit?: string;
|
};
|
|
const props = withDefaults(defineProps<Props>(), {
|
useThousand: true,
|
unit: '元',
|
});
|
|
const displayValue = computed(() => (props.useThousand ? toThousand(props.value) : props.value));
|
</script>
|
|
<style lang="scss" scoped>
|
@use '@/style/common.scss' as *;
|
|
.data-board-card-price {
|
display: flex;
|
align-items: flex-end;
|
|
.data-board-card-value {
|
margin-right: 4px;
|
font-size: 20px;
|
font-weight: bold;
|
color: getCssVar('text-color', 'primary');
|
}
|
|
.data-board-card-unit {
|
font-size: 14px;
|
color: getCssVar('text-color', 'primary');
|
}
|
}
|
</style>
|