diff --git a/components.d.ts b/components.d.ts index f845343c..72990be6 100644 --- a/components.d.ts +++ b/components.d.ts @@ -52,6 +52,8 @@ declare module 'vue' { PopConfirm: typeof import('./src/components/PopConfirm.vue')['default'] RepeatSetting: typeof import('./src/components/toolbar/RepeatSetting.vue')['default'] Ring: typeof import('./src/components/Ring.vue')['default'] + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] SettingDialog: typeof import('./src/components/dialog/SettingDialog.vue')['default'] Slide: typeof import('./src/components/Slide.vue')['default'] Toolbar: typeof import('./src/components/toolbar/index.vue')['default'] diff --git a/src/components/dialog/Dialog.vue b/src/components/dialog/Dialog.vue index 05710c64..f4959270 100644 --- a/src/components/dialog/Dialog.vue +++ b/src/components/dialog/Dialog.vue @@ -18,7 +18,8 @@ export interface ModalProps { header?: boolean confirmButtonText?: string cancelButtonText?: string, - keyboard?: boolean + keyboard?: boolean, + confirm?: any } const props = withDefaults(defineProps(), { @@ -39,6 +40,7 @@ const emit = defineEmits([ 'cancel', ]) +let confirmButtonLoading = $ref(false) let zIndex = $ref(999) let visible = $ref(false) let openTime = $ref(Date.now()) @@ -118,6 +120,11 @@ useEventListener('keyup', (e: KeyboardEvent) => { }) async function ok() { + if (props.confirm) { + confirmButtonLoading = true + await props.confirm() + confirmButtonLoading = false + } await close() emit('ok') } @@ -162,7 +169,10 @@ async function cancel() {
{{ cancelButtonText }} - {{ confirmButtonText }} + {{ confirmButtonText }} +
diff --git a/src/components/list/VirtualWordList2.vue b/src/components/list/VirtualWordList2.vue index 6b22987f..f725bdac 100644 --- a/src/components/list/VirtualWordList2.vue +++ b/src/components/list/VirtualWordList2.vue @@ -54,10 +54,14 @@ function reset() { } function scrollToBottom() { - listRef.scrollToIndex(props.list.length - 1) + listRef.scrollToBottom() } -defineExpose({scrollToBottom}) +function scrollToItem(index: number) { + listRef.scrollToItem(index) +} + +defineExpose({scrollToBottom, scrollToItem}) diff --git a/src/components/toolbar/RepeatSetting.vue b/src/components/toolbar/RepeatSetting.vue index 5d6fc8ea..fe584af9 100644 --- a/src/components/toolbar/RepeatSetting.vue +++ b/src/components/toolbar/RepeatSetting.vue @@ -14,7 +14,6 @@ const store = useBaseStore() const settingStore = useSettingStore() let show = $ref(false) -let radio1 = $ref('1') useWindowClick(() => show = false) let timer = 0 diff --git a/src/pages/dict/ChapterWordList.vue b/src/pages/dict/ChapterWordList.vue index 1e3746c8..f9a8b3d7 100644 --- a/src/pages/dict/ChapterWordList.vue +++ b/src/pages/dict/ChapterWordList.vue @@ -1,12 +1,15 @@