mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 17:24:26 +08:00
code refactor
This commit is contained in:
@@ -104,6 +104,7 @@ const transactionTagsStore = useTransactionTagsStore();
|
|||||||
|
|
||||||
const selectedItemIds = ref<string[]>(copyArrayTo(props.modelValue, []));
|
const selectedItemIds = ref<string[]>(copyArrayTo(props.modelValue, []));
|
||||||
const newTag = ref<TransactionTag | null>(null);
|
const newTag = ref<TransactionTag | null>(null);
|
||||||
|
const heightClass = ref<string>(getHeightClass());
|
||||||
|
|
||||||
const allTags = computed<TransactionTag[]>(() => transactionTagsStore.allTransactionTags);
|
const allTags = computed<TransactionTag[]>(() => transactionTagsStore.allTransactionTags);
|
||||||
|
|
||||||
@@ -119,15 +120,15 @@ const noAvailableTag = computed<boolean>(() => {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
const heightClass = computed<string>(() => {
|
function getHeightClass(): string {
|
||||||
if (transactionTagsStore.allTransactionTags && transactionTagsStore.allTransactionTags.length > 10) {
|
if (transactionTagsStore.allTransactionTags && transactionTagsStore.allTransactionTags.length > 8) {
|
||||||
return 'tag-selection-huge-sheet';
|
return 'tag-selection-huge-sheet';
|
||||||
} else if (transactionTagsStore.allTransactionTags && transactionTagsStore.allTransactionTags.length > 6) {
|
} else if (transactionTagsStore.allTransactionTags && transactionTagsStore.allTransactionTags.length > 4) {
|
||||||
return 'tag-selection-large-sheet';
|
return 'tag-selection-large-sheet';
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
function isChecked(itemId: string): boolean {
|
function isChecked(itemId: string): boolean {
|
||||||
return selectedItemIds.value.indexOf(itemId) >= 0;
|
return selectedItemIds.value.indexOf(itemId) >= 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user