2018-05-08 02:04:43 -04:00
|
|
|
<template>
|
|
|
|
<div id="rename-page">
|
2018-05-08 11:56:02 -04:00
|
|
|
<el-form
|
|
|
|
@submit.native.prevent
|
|
|
|
>
|
2018-05-08 02:04:43 -04:00
|
|
|
<el-form-item
|
|
|
|
label="文件改名"
|
|
|
|
>
|
|
|
|
<el-input
|
|
|
|
v-model="fileName"
|
|
|
|
size="small"
|
2018-05-08 11:56:02 -04:00
|
|
|
@keyup.enter.native="confirmName"
|
2018-05-08 02:04:43 -04:00
|
|
|
></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
<el-row>
|
|
|
|
<div class="pull-right">
|
|
|
|
<el-button @click="cancel" round size="mini">取消</el-button>
|
|
|
|
<el-button type="primary" @click="confirmName" round size="mini">确定</el-button>
|
|
|
|
</div>
|
|
|
|
</el-row>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
2018-12-10 04:13:48 -05:00
|
|
|
import mixin from '@/utils/mixin'
|
2018-05-08 02:04:43 -04:00
|
|
|
export default {
|
|
|
|
name: 'rename-page',
|
2018-11-25 10:53:26 -05:00
|
|
|
mixins: [mixin],
|
2018-05-08 02:04:43 -04:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
fileName: '',
|
|
|
|
id: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created () {
|
|
|
|
this.$electron.ipcRenderer.on('rename', (event, name, id) => {
|
|
|
|
this.fileName = name
|
|
|
|
this.id = id
|
|
|
|
})
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
confirmName () {
|
|
|
|
this.$electron.ipcRenderer.send(`rename${this.id}`, this.fileName)
|
|
|
|
},
|
|
|
|
cancel () {
|
|
|
|
this.$electron.ipcRenderer.send(`rename${this.id}`, null)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
beforeDestroy () {
|
|
|
|
this.$electron.ipcRenderer.removeAllListeners('rename')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang='stylus'>
|
|
|
|
#rename-page
|
|
|
|
padding 0 20px
|
|
|
|
.pull-right
|
|
|
|
float right
|
|
|
|
.el-form-item__label
|
|
|
|
color #ddd
|
|
|
|
</style>
|