|
1 | 1 | <script setup lang="ts"> |
2 | | - import { Bill, BillManager } from "./bill.ts"; |
| 2 | + import MarkdownIt from "markdown-it"; |
| 3 | +import { BillManager } from "./bill.ts"; |
3 | 4 | const bills = BillManager.getBills(); |
| 5 | + const mdRenderer = new MarkdownIt(); |
4 | 6 | </script> |
5 | 7 |
|
6 | 8 | <template> |
|
21 | 23 | </p> |
22 | 24 | </div> |
23 | 25 | </div> |
24 | | - <div class="border border-[var(--vp-c-brand-3)] rounded-[20px] p-2 m-2 flex flex-col gap-2 bg-[var(--vp-c-divider)]"> |
| 26 | + <div class="border border-(--vp-c-brand-3) rounded-[20px] p-2 m-2 flex flex-col gap-2 bg-(--vp-c-divider)"> |
25 | 27 | <div class="collapse collapse-arrow rounded-[12.5px]" v-for="bill in bills"> |
26 | 28 | <input type="checkbox" /> |
27 | | - <div class="collapse-title font-semibold flex gap-2 bg-[var(--vp-nav-screen-bg-color)]"> |
| 29 | + <div class="collapse-title font-semibold flex gap-2 bg-(--vp-nav-screen-bg-color)"> |
28 | 30 | <svg |
29 | 31 | v-if="bill.type === 'outlay'" |
30 | 32 | width="28" |
|
66 | 68 | opacity: 75%; |
67 | 69 | border-top: 0px; |
68 | 70 | margin: 0px; |
69 | | - margin-top: 8px; |
| 71 | + margin-top: 10px; |
70 | 72 | border-right: 1px solid var(--vp-c-divider); |
71 | | - margin-right: 4px; |
| 73 | + margin-right: 8px; |
72 | 74 | padding-right: 8px; |
73 | 75 | padding-top: 2px; |
74 | 76 | "> |
75 | | - {{ bill["original-unit"] + bill["original-amount"] }} |
| 77 | + {{ bill["original-unit"] + bill["original-amount"].toFixed(2) }} |
76 | 78 | </h3> |
77 | | - <h2 style="border-top: 0px; margin: 0px; padding-top: 8px">{{ |
78 | | - bill["type"] === "income" ? "+" : bill["type"] === "outlay" ? "-" : "" |
79 | | - }}¥{{ bill["exchanged-amount"] }}</h2> |
| 79 | + <h2 style="border-top: 0px; margin: 0px; padding-top: 8px"> |
| 80 | + {{ bill["type"] === "income" ? "+" : bill["type"] === "outlay" ? "-" : "" }}¥{{ bill["exchanged-amount"].toFixed(2) }} |
| 81 | + </h2> |
80 | 82 | </div> |
81 | 83 | </div> |
82 | | - <div class="collapse-content text-sm bg-[var(--vp-nav-screen-bg-color)]"> |
| 84 | + <div class="collapse-content text-sm bg-(--vp-nav-screen-bg-color)"> |
83 | 85 | <div class="flex gap-2 items-center"> |
84 | | - <div class="badge badge-md badge-inline text-[var(--vp-nav-screen-bg-color)]" style="--badge-color: var(--vp-c-brand-3)"> |
| 86 | + <div class="badge badge-md badge-inline text-(--vp-nav-screen-bg-color)" style="--badge-color: var(--vp-c-brand-3)"> |
85 | 87 | {{ |
86 | 88 | bill["type"] === "income" ? "收入来源" : bill["type"] === "outlay" ? "支出目标" : "交易对象" |
87 | 89 | }} |
88 | 90 | </div> |
89 | 91 | {{ bill["target"] }} |
90 | 92 | </div> |
91 | 93 | <div class="flex gap-2 items-center mt-1"> |
92 | | - <div class="badge badge-md badge-inline text-[var(--vp-nav-screen-bg-color)]" style="--badge-color: var(--vp-c-warning-1)"> |
| 94 | + <div class="badge badge-md badge-inline text-(--vp-nav-screen-bg-color)" style="--badge-color: var(--vp-c-warning-1)"> |
93 | 95 | 交易内容 |
94 | 96 | </div> |
95 | | - {{ bill["description"] }} |
| 97 | + <div id="bill-description" class="mt-0 mb-0" v-html="mdRenderer.render(bill['description'])"></div> |
96 | 98 | </div> |
97 | 99 | </div> |
98 | 100 | </div> |
|
123 | 125 | margin-left: 7.5px; |
124 | 126 | color: black; |
125 | 127 | } |
| 128 | + #bill-description p { |
| 129 | + margin: 0px; |
| 130 | + } |
126 | 131 | </style> |
0 commit comments