50 lines
1.3 KiB
Vue
50 lines
1.3 KiB
Vue
<template>
|
|
<div class="independent-window">
|
|
<ChoiceForm ref="formRef" :isIndependent="true" />
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref, onMounted } from 'vue'
|
|
import { listen } from '@tauri-apps/api/event'
|
|
import { getCurrentWindow } from '@tauri-apps/api/window'
|
|
import ChoiceForm from '@/views/paper/question/ChoiceForm.vue'
|
|
|
|
defineOptions({ name: 'ChoiceIndependent' })
|
|
|
|
const formRef = ref()
|
|
|
|
onMounted(async () => {
|
|
console.log('ChoiceIndependent mounted, sending ready signal...')
|
|
|
|
// 发送窗口准备就绪信号
|
|
try {
|
|
const { emit } = await import('@tauri-apps/api/event')
|
|
await emit('choice-window-ready', { timestamp: Date.now() })
|
|
console.log('Sent choice-window-ready event')
|
|
} catch (error) {
|
|
console.error('Failed to send ready signal:', error)
|
|
}
|
|
|
|
// 监听表单提交成功事件,关闭窗口
|
|
await listen('choice-form-success', async () => {
|
|
const appWindow = getCurrentWindow()
|
|
await appWindow.close()
|
|
})
|
|
|
|
// 监听表单取消事件,关闭窗口
|
|
await listen('choice-form-cancel', async () => {
|
|
const appWindow = getCurrentWindow()
|
|
await appWindow.close()
|
|
})
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.independent-window {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
overflow: hidden;
|
|
}
|
|
</style>
|