3d模型3视图

This commit is contained in:
X1627315083@163.com
2026-03-18 14:51:22 +08:00
parent 78fa8d965f
commit 359766f59c
11 changed files with 82 additions and 37 deletions

View File

@@ -7,12 +7,14 @@
<script setup lang="ts">
import FullscreenDialog from '../components/fullscreen-dialog.vue'
import flowCanvas from './flow-canvas.vue'
import { ref } from 'vue'
import { ref, onMounted, onBeforeUnmount } from 'vue'
import { getSketchFlowCanvas, putSketchFlowCanvas } from '@/api/flow-canvas'
import { useI18n } from 'vue-i18n'
const dialogVisible = ref(false)
const config = ref({}) as any
const flowCanvasRef = ref<any>()
const {t:$t} = useI18n()
const open = async (options) => {
let json = []
await new Promise((resolve) => {
@@ -47,6 +49,21 @@
await exportFlow(str)
dialogVisible.value = false
}
const handleBeforeUnload = (event) => {
const str = flowCanvasRef.value?.getFlowJson()
if (str) {
event.preventDefault()
event.returnValue = $t('flowCanvas.confirmLeave')
return $t('flowCanvas.confirmLeave')
}
}
onMounted(() => {
// 添加事件监听
window.addEventListener('beforeunload', handleBeforeUnload)
})
onBeforeUnmount(() => {
window.removeEventListener('beforeunload', handleBeforeUnload)
})
defineExpose({
open,
close,