1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
| <template>
| <div class="data-board-card-price" :class="isInline && 'inline'">
| <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;
| isInline?: boolean;
| unit?: string;
| };
|
| const props = withDefaults(defineProps<Props>(), {
| useThousand: true,
| isInline: false,
| 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;
|
| &.inline {
| display: inline-flex;
| }
|
| .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>
|
|