|
@@ -32,13 +32,14 @@
|
|
|
<script setup>
|
|
|
import { onMounted, ref, watch } from 'vue'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
-import { useRoute } from 'vue-router'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
import { getProjectInfo } from '../store/app'
|
|
|
import { toPage } from '../utils/tools'
|
|
|
|
|
|
//初始组合式
|
|
|
const store = useAppStore()
|
|
|
const useRoutes = useRoute()
|
|
|
+const router = useRouter()
|
|
|
|
|
|
//项目信息
|
|
|
const projectInfo = ref(store.projectInfo)
|
|
@@ -53,7 +54,10 @@ const isMain = ref(false)
|
|
|
onMounted(async () => {
|
|
|
const { code } = await getProjectInfo()
|
|
|
if (code !== 200) {
|
|
|
- toPage('/project', { source: '' })
|
|
|
+ await router.push({
|
|
|
+ path: '/project',
|
|
|
+ query: { source: '' },
|
|
|
+ })
|
|
|
}
|
|
|
isMain.value = true
|
|
|
setIpcRenderer()
|
|
@@ -62,9 +66,9 @@ onMounted(async () => {
|
|
|
//设置通信监听
|
|
|
const setIpcRenderer = () => {
|
|
|
window.electron.ipcRenderer.on('open-file', (event, { data }) => {
|
|
|
- toPage('/project', {
|
|
|
- path: data,
|
|
|
- source: '',
|
|
|
+ router.push({
|
|
|
+ path: '/project',
|
|
|
+ query: { path: data, source: '' },
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -72,8 +76,9 @@ const setIpcRenderer = () => {
|
|
|
//项目管理
|
|
|
const handleProject = () => {
|
|
|
const { path } = useRoutes
|
|
|
- toPage('/project', {
|
|
|
- source: path ?? '',
|
|
|
+ router.push({
|
|
|
+ path: '/project',
|
|
|
+ query: { source: path ?? '' },
|
|
|
})
|
|
|
}
|
|
|
|