fix: 优化分类列表显示逻辑,简化分类视图计算
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 18s
Docker Build & Deploy / Deploy to Production (push) Successful in 8s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 18s
Docker Build & Deploy / Deploy to Production (push) Successful in 8s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
This commit is contained in:
@@ -102,9 +102,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 分类列表 -->
|
<!-- 分类列表 -->
|
||||||
<div v-if="expenseCategoriesView.length > 0" class="category-list">
|
<div v-if="expenseCategoriesSimpView.length > 0" class="category-list">
|
||||||
<div
|
<div
|
||||||
v-for="(category) in expenseCategoriesView"
|
v-for="(category) in expenseCategoriesSimpView"
|
||||||
:key="category.isOther ? 'other' : category.classify"
|
:key="category.isOther ? 'other' : category.classify"
|
||||||
class="category-item clickable"
|
class="category-item clickable"
|
||||||
@click="category.isOther ? (showAllExpense = true) : goToCategoryBills(category.classify, 0)"
|
@click="category.isOther ? (showAllExpense = true) : goToCategoryBills(category.classify, 0)"
|
||||||
@@ -386,13 +386,8 @@ const expenseCategories = ref([])
|
|||||||
const incomeCategories = ref([])
|
const incomeCategories = ref([])
|
||||||
const noneCategories = ref([])
|
const noneCategories = ref([])
|
||||||
|
|
||||||
const expenseCategoriesView = computed(() => {
|
const expenseCategoriesSimpView = computed(() => {
|
||||||
const list = [...expenseCategories.value]
|
const list = expenseCategoriesView.value
|
||||||
const unclassifiedIndex = list.findIndex(c => !c.classify)
|
|
||||||
if (unclassifiedIndex !== -1) {
|
|
||||||
const [unclassified] = list.splice(unclassifiedIndex, 1)
|
|
||||||
list.unshift(unclassified)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showAllExpense.value || list.length <= 7) return list
|
if (showAllExpense.value || list.length <= 7) return list
|
||||||
|
|
||||||
@@ -409,6 +404,17 @@ const expenseCategoriesView = computed(() => {
|
|||||||
return top
|
return top
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const expenseCategoriesView = computed(() => {
|
||||||
|
const list = [...expenseCategories.value]
|
||||||
|
const unclassifiedIndex = list.findIndex(c => !c.classify)
|
||||||
|
if (unclassifiedIndex !== -1) {
|
||||||
|
const [unclassified] = list.splice(unclassifiedIndex, 1)
|
||||||
|
list.unshift(unclassified)
|
||||||
|
}
|
||||||
|
|
||||||
|
return list
|
||||||
|
})
|
||||||
|
|
||||||
const incomeCategoriesView = computed(() => {
|
const incomeCategoriesView = computed(() => {
|
||||||
const list = [...incomeCategories.value]
|
const list = [...incomeCategories.value]
|
||||||
const unclassifiedIndex = list.findIndex(c => !c.classify)
|
const unclassifiedIndex = list.findIndex(c => !c.classify)
|
||||||
|
|||||||
Reference in New Issue
Block a user