code refactor

This commit is contained in:
MaysWind
2025-02-12 23:26:03 +08:00
parent 30575d15d0
commit 0b5721671d
6 changed files with 11 additions and 85 deletions
+1 -2
View File
@@ -13,7 +13,6 @@ import { ref, computed, useTemplateRef } from 'vue';
import { useI18n } from '@/locales/helpers.ts';
import { copyObjectTo } from '@/lib/common.ts';
import type { MapInstance, MapPosition } from '@/lib/map/base.ts';
import { createMapInstance } from '@/lib/map/index.ts';
@@ -38,7 +37,7 @@ const mapSupported = computed<boolean>(() => !!mapInstance.value);
const mapDependencyLoaded = computed<boolean>(() => mapInstance.value?.dependencyLoaded || false);
const finalMapStyle = computed<Record<string, unknown>>(() => {
const styles: Record<string, unknown> = copyObjectTo(props.mapStyle, {});
const styles: Record<string, unknown> = Object.assign({}, props.mapStyle);
if (props.height) {
styles['height'] = props.height;
@@ -93,7 +93,6 @@ import { useI18nUIComponents, showLoading, hideLoading } from '@/lib/ui/mobile.t
import { TransactionTag } from '@/models/transaction_tag.ts';
import { useTransactionTagsStore } from '@/stores/transactionTag.ts';
import { copyArrayTo } from '@/lib/common.ts';
import { type Framework7Dom, scrollToSelectedItem, scrollSheetToTop } from '@/lib/ui/mobile.ts';
const props = defineProps<{
@@ -117,7 +116,7 @@ const sheet = useTemplateRef<Sheet.Sheet>('sheet');
const searchbar = useTemplateRef<Searchbar.Searchbar>('searchbar');
const filterContent = ref<string>('');
const selectedItemIds = ref<string[]>(copyArrayTo(props.modelValue, []));
const selectedItemIds = ref<string[]>(Array.from(props.modelValue));
const newTag = ref<TransactionTag | null>(null);
const heightClass = ref<string>(getHeightClass());
@@ -227,7 +226,7 @@ function onSearchBarFocus(): void {
}
function onSheetOpen(event: { $el: Framework7Dom }): void {
selectedItemIds.value = copyArrayTo(props.modelValue, []);
selectedItemIds.value = Array.from(props.modelValue);
newTag.value = null;
scrollToSelectedItem(event.$el, '.page-content', 'li.list-item-selected');
}