code refactor

This commit is contained in:
MaysWind
2025-01-11 13:59:47 +08:00
parent 61f26e060e
commit 89b233e51b
25 changed files with 128 additions and 128 deletions
+7 -7
View File
@@ -15,7 +15,7 @@
</template>
<script setup lang="ts">
import { type Ref, ref, watch } from 'vue';
import { ref, watch } from 'vue';
import { useI18n } from '@/locales/helpers.ts';
@@ -29,20 +29,20 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
(e: 'update:show', value: boolean): void
(e: 'update:show', value: boolean): void;
}>();
const { tt } = useI18n();
const showState: Ref<boolean> = ref(false);
const titleContent: Ref<string> = ref(props.title || tt('global.app.title'));
const textContent: Ref<string> = ref(props.text || '');
const finalColor: Ref<string> = ref(props.color || 'primary');
const showState = ref<boolean>(false);
const titleContent = ref<string>(props.title || tt('global.app.title'));
const textContent = ref<string>(props.text || '');
const finalColor = ref<string>(props.color || 'primary');
let resolveFunc: ((value?: unknown) => void) | null = null;
let rejectFunc: ((reason?: unknown) => void) | null = null;
function open(titleOrText: string, textOrOptions: string | Record<string, unknown>, options: Record<string, unknown>) {
function open(titleOrText: string, textOrOptions: string | Record<string, unknown>, options: Record<string, unknown>): Promise<unknown> {
showState.value = true;
if (isString(textOrOptions)) { // second parameter is text