Skip to content

Commit

Permalink
🐛 Fix: correct inputbox value && remove listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Feb 25, 2020
1 parent 96544f5 commit 32334e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/renderer/components/InputBoxDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
:title="inputBoxOptions.title || '输入框'"
:visible.sync="showInputBoxVisible"
:modal-append-to-body="false"
@close="handleInputBoxClose"
>
<el-input
v-model="inputBoxValue"
:placeholder="inputBoxOptions.placeholder"></el-input>
<span slot="footer">
<el-button @click="showInputBoxVisible = false" round>取消</el-button>
<el-button type="primary" @click="showInputBoxVisible = false" round>确定</el-button>
<el-button @click="handleInputBoxCancel" round>取消</el-button>
<el-button type="primary" @click="handleInputBoxConfirm" round>确定</el-button>
</span>
</el-dialog>
</template>
Expand Down Expand Up @@ -44,11 +43,17 @@ export default class extends Vue {
this.inputBoxOptions.placeholder = options.placeholder || ''
this.showInputBoxVisible = true
}
handleInputBoxClose () {
handleInputBoxCancel () {
// TODO: RPCServer
this.showInputBoxVisible = false
ipcRenderer.send(SHOW_INPUT_BOX, '')
this.$bus.$emit(SHOW_INPUT_BOX_RESPONSE, '')
}
handleInputBoxConfirm () {
this.showInputBoxVisible = false
ipcRenderer.send(SHOW_INPUT_BOX, this.inputBoxValue)
this.$bus.$emit(SHOW_INPUT_BOX_RESPONSE, this.inputBoxValue)
}
beforeDestroy () {
ipcRenderer.removeListener(SHOW_INPUT_BOX, this.ipcEventHandler)
this.$bus.$off(SHOW_INPUT_BOX)
Expand Down
1 change: 1 addition & 0 deletions src/renderer/pages/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export default class extends Vue {
}
}
beforeDestroy () {
this.$bus.$off(SHOW_INPUT_BOX_RESPONSE)
ipcRenderer.removeAllListeners('uploadProgress')
ipcRenderer.removeAllListeners('syncPicBed')
ipcRenderer.removeListener('getPicBeds', this.getPicBeds)
Expand Down

0 comments on commit 32334e9

Please sign in to comment.