mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-08-03 20:26:56 +08:00
migrate DependenciesSetupProgressIndicatorDialog mount logic to single file
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { createApp } from 'vue'
|
||||
import ElementPlus from 'element-plus'
|
||||
import DependenciesSetupProgressIndicatorDialog from './index.vue'
|
||||
|
||||
export const mountGlobalDialog = () => {
|
||||
const containerElId = `elForDependenciesSetupProgressIndicatorDialog`
|
||||
|
||||
if (document.getElementById(containerElId)) {
|
||||
return
|
||||
}
|
||||
let containerEl: null | HTMLElement = (() => {
|
||||
const el = document.createElement('div')
|
||||
el.id = containerElId
|
||||
return el
|
||||
})()
|
||||
document.body.append(containerEl)
|
||||
|
||||
const dispose = () => {
|
||||
app?.unmount()
|
||||
containerEl?.remove()
|
||||
|
||||
app = null
|
||||
containerEl = null
|
||||
}
|
||||
let app: null | ReturnType<typeof createApp> = createApp(DependenciesSetupProgressIndicatorDialog, {
|
||||
modelValue: true,
|
||||
onClosed() {
|
||||
dispose()
|
||||
}
|
||||
}).use(ElementPlus)
|
||||
app.mount(containerEl)
|
||||
|
||||
return {
|
||||
dispose
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@
|
||||
<el-button type="primary" @click="handleSubmit"> I'm ready, geekgeekgo! </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<DependenciesSetupProgressIndicatorDialog v-model="shouldShowDependenciesSetupProgressIndicatorDialog" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -36,7 +35,7 @@ import { onUnmounted, ref } from 'vue'
|
||||
import JSON5 from 'json5'
|
||||
import { ElForm, ElMessage, ElMessageBox } from 'element-plus'
|
||||
import router from '../../router/index'
|
||||
import DependenciesSetupProgressIndicatorDialog from '../../features/DependenciesSetupProgressIndicatorDialog/index.vue'
|
||||
import { mountGlobalDialog as mountDependenciesSetupProgressIndicatorDialog } from '@renderer/features/DependenciesSetupProgressIndicatorDialog/operations'
|
||||
|
||||
const formContent = ref({
|
||||
bossZhipinCookies: '',
|
||||
@@ -118,13 +117,11 @@ const handleExpectCompaniesInputBlur = (event) => {
|
||||
.join(',')
|
||||
}
|
||||
|
||||
const shouldShowDependenciesSetupProgressIndicatorDialog = ref(false)
|
||||
|
||||
const needWarmingUpDenpendenciesHandler = () => {
|
||||
shouldShowDependenciesSetupProgressIndicatorDialog.value = true
|
||||
const processDialog = mountDependenciesSetupProgressIndicatorDialog()
|
||||
|
||||
const handlePuppeteerDownloadFinished = () => {
|
||||
shouldShowDependenciesSetupProgressIndicatorDialog.value = false
|
||||
processDialog?.dispose()
|
||||
}
|
||||
electron.ipcRenderer.once('PUPPETEER_DOWNLOAD_FINISHED', handlePuppeteerDownloadFinished)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user