Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Commit 8aabfa0

Browse files
author
icymind
committed
Prepare.vue: refresh modal's position after nextTick
1 parent a207bb4 commit 8aabfa0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/renderer/components/Prepare.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
</template>
1212

1313
<script>
14+
/* global $ */
1415
import UIModal from '@/components/Prepare/UIModal.vue'
1516
import VBox from '@/lib/vbox.js'
1617
import Utils from '@/lib/utils.js'
@@ -19,7 +20,7 @@ import winston from '@/lib/logger.js'
1920
2021
const fs = require('fs-extra')
2122
const path = require('path')
22-
const { app, getCurrentWindow } = require('electron').remote
23+
const { app } = require('electron').remote
2324
const { EventEmitter } = require('events')
2425
2526
let vueInstance = null
@@ -131,13 +132,6 @@ const startVmModal = {
131132
closable: false
132133
}
133134
134-
function adjustModal () {
135-
const win = getCurrentWindow()
136-
const size = win.getSize()
137-
win.setSize(size[0], size[1] + 1)
138-
win.setSize(size[0], size[1])
139-
}
140-
141135
export default {
142136
name: 'prepare',
143137
data () {
@@ -210,7 +204,9 @@ export default {
210204
const process = new EventEmitter()
211205
process.on('init', (msg) => {
212206
this.modalInfo.content += `<li class="ui">${msg}</li>`
213-
adjustModal()
207+
this.$nextTick(() => {
208+
$('.ui.modal').modal('refresh')
209+
})
214210
})
215211
try {
216212
await VBox.delete(this.vrouter.name)
@@ -219,7 +215,9 @@ export default {
219215
winston.error(`build error: ${error}`)
220216
errorModal.content = `<pre>${error.stack}</pre>`
221217
this.showModal('errorModal')
222-
adjustModal()
218+
this.$nextTick(() => {
219+
$('.ui.modal').modal('refresh')
220+
})
223221
return
224222
}
225223
return this.checkRequirement()
@@ -244,7 +242,9 @@ export default {
244242
winston.error('fail to start vm')
245243
startVMErrorModal.content = `<pre>${error.stack}</pre>`
246244
this.showModal('startVMErrorModal')
247-
adjustModal()
245+
this.$nextTick(() => {
246+
$('.ui.modal').modal('refresh')
247+
})
248248
return
249249
}
250250
clearInterval(interval)

0 commit comments

Comments
 (0)