mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
code refactor
This commit is contained in:
@@ -34,13 +34,8 @@ const initCenter = ref<MapPosition>({
|
||||
});
|
||||
const zoomLevel = ref<number>(1);
|
||||
|
||||
const mapSupported = computed<boolean>(() => {
|
||||
return !!mapInstance.value;
|
||||
});
|
||||
|
||||
const mapDependencyLoaded = computed<boolean>(() => {
|
||||
return mapInstance.value?.dependencyLoaded || false;
|
||||
});
|
||||
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, {});
|
||||
|
||||
@@ -72,9 +72,7 @@ const icons = {
|
||||
const dropdownMenu = useTemplateRef<HTMLElement>('dropdownMenu');
|
||||
const itemPerRow = ref<number>(props.columnCount || 7);
|
||||
|
||||
const allColorRows = computed<ColorInfo[][]>(() => {
|
||||
return getColorsInRows(props.allColorInfos, itemPerRow.value);
|
||||
});
|
||||
const allColorRows = computed<ColorInfo[][]>(() => getColorsInRows(props.allColorInfos, itemPerRow.value));
|
||||
|
||||
const color = computed<ColorValue>({
|
||||
get: () => props.modelValue,
|
||||
|
||||
@@ -99,9 +99,7 @@ const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWee
|
||||
const dayNames = computed<string[]>(() => arrangeArrayWithNewStartIndex(getAllMinWeekdayNames(), firstDayOfWeek.value));
|
||||
const isYearFirst = computed<boolean>(() => isLongDateMonthAfterYear());
|
||||
const is24Hour = computed<boolean>(() => isLongTime24HourFormat());
|
||||
const displayTime = computed<string>(() => {
|
||||
return formatUnixTimeToLongDateTime(getActualUnixTimeForStore(getUnixTime(dateTime.value), getTimezoneOffsetMinutes(), getBrowserTimezoneOffsetMinutes()));
|
||||
});
|
||||
const displayTime = computed<string>(() => formatUnixTimeToLongDateTime(getActualUnixTimeForStore(getUnixTime(dateTime.value), getTimezoneOffsetMinutes(), getBrowserTimezoneOffsetMinutes())));
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -70,9 +70,7 @@ const icons = {
|
||||
const dropdownMenu = useTemplateRef<HTMLElement>('dropdownMenu');
|
||||
const itemPerRow = ref<number>(props.columnCount || 7);
|
||||
|
||||
const allIconRows = computed<IconInfoWithId[][]>(() => {
|
||||
return getIconsInRows(props.allIconInfos, itemPerRow.value);
|
||||
});
|
||||
const allIconRows = computed<IconInfoWithId[][]>(() => getIconsInRows(props.allIconInfos, itemPerRow.value));
|
||||
|
||||
const icon = computed<string>({
|
||||
get: () => props.modelValue,
|
||||
|
||||
@@ -63,9 +63,7 @@ const emit = defineEmits<{
|
||||
(e: 'step:change', stepName: string): void;
|
||||
}>();
|
||||
|
||||
const isClickable = computed<boolean>(() => {
|
||||
return props.clickable !== 'false' && props.clickable !== false;
|
||||
});
|
||||
const isClickable = computed<boolean>(() => props.clickable !== 'false' && props.clickable !== false);
|
||||
|
||||
function changeStep(step: StepBarItem): void {
|
||||
if (isClickable.value) {
|
||||
|
||||
@@ -55,9 +55,7 @@ const { tt } = useI18n();
|
||||
const currentValue = ref<ColorValue>(props.modelValue);
|
||||
const itemPerRow = ref<number>(props.columnCount || 7);
|
||||
|
||||
const allColorRows = computed<ColorInfo[][]>(() => {
|
||||
return getColorsInRows(props.allColorInfos, itemPerRow.value);
|
||||
});
|
||||
const allColorRows = computed<ColorInfo[][]>(() => getColorsInRows(props.allColorInfos, itemPerRow.value));
|
||||
|
||||
function onColorClicked(colorInfo: ColorInfo): void {
|
||||
currentValue.value = colorInfo.color;
|
||||
|
||||
@@ -109,9 +109,7 @@ const isDarkMode = computed<boolean>(() => environmentsStore.framework7DarkMode
|
||||
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
|
||||
const dayNames = computed<string[]>(() => arrangeArrayWithNewStartIndex(getAllMinWeekdayNames(), firstDayOfWeek.value));
|
||||
const isYearFirst = computed<boolean>(() => isLongDateMonthAfterYear());
|
||||
const displayTime = computed<string>(() => {
|
||||
return formatUnixTimeToLongDateTime(getActualUnixTimeForStore(getUnixTime(dateTime.value), getTimezoneOffsetMinutes(), getBrowserTimezoneOffsetMinutes()));
|
||||
});
|
||||
const displayTime = computed<string>(() => formatUnixTimeToLongDateTime(getActualUnixTimeForStore(getUnixTime(dateTime.value), getTimezoneOffsetMinutes(), getBrowserTimezoneOffsetMinutes())));
|
||||
const switchButtonTitle = computed<string>(() => mode.value === 'time' ? 'Date' : 'Time');
|
||||
|
||||
function switchMode(): void {
|
||||
|
||||
@@ -56,9 +56,7 @@ const { tt } = useI18n();
|
||||
const currentValue = ref<string>(props.modelValue);
|
||||
const itemPerRow = ref<number>(props.columnCount || 7);
|
||||
|
||||
const allIconRows = computed<IconInfoWithId[][]>(() => {
|
||||
return getIconsInRows(props.allIconInfos, itemPerRow.value);
|
||||
});
|
||||
const allIconRows = computed<IconInfoWithId[][]>(() => getIconsInRows(props.allIconInfos, itemPerRow.value));
|
||||
|
||||
const heightClass = computed<string>(() => {
|
||||
if (allIconRows.value.length > 10) {
|
||||
|
||||
@@ -50,9 +50,7 @@ const { tt } = useI18n();
|
||||
|
||||
const currentPinCode = ref<string>('');
|
||||
|
||||
const currentPinCodeValid = computed<boolean>(() => {
|
||||
return currentPinCode.value?.length === 6 || false;
|
||||
});
|
||||
const currentPinCodeValid = computed<boolean>(() => currentPinCode.value?.length === 6 || false);
|
||||
|
||||
function confirm(): void {
|
||||
if (!currentPinCodeValid.value || props.confirmDisabled) {
|
||||
|
||||
Reference in New Issue
Block a user