feat: 客户端快捷键关闭侧滑窗

This commit is contained in:
kuaifan 2021-12-23 21:49:27 +08:00
parent 544496a09b
commit 20a6da4944
3 changed files with 25 additions and 1 deletions

View File

@ -53,7 +53,7 @@ export default {
},
computed: {
...mapState(['taskId']),
...mapState(['taskId', 'cacheDrawerOverlay']),
},
watch: {
@ -181,6 +181,10 @@ export default {
if (this.$Modal.removeLast()) {
return;
}
if (this.cacheDrawerOverlay.length > 0) {
this.cacheDrawerOverlay[this.cacheDrawerOverlay.length - 1].close();
return;
}
ipcRenderer.send('windowHidden');
})
}

View File

@ -15,6 +15,8 @@
</template>
<script>
import state from "../store/state";
export default {
name: 'DrawerOverlay',
props: {
@ -74,6 +76,23 @@
}
},
watch: {
value(val) {
if (this._uid) {
const index = this.$store.state.cacheDrawerOverlay.findIndex(({_uid}) => _uid === this._uid);
if (val && index === -1) {
this.$store.state.cacheDrawerOverlay.push({
_uid: this._uid,
close: this.close
});
}
if (!val && index > -1) {
this.$store.state.cacheDrawerOverlay.splice(index, 1);
}
}
}
},
methods: {
mask () {
if (this.maskClosable) {

View File

@ -255,6 +255,7 @@ state.windowMax768 = window.innerWidth <= 768;
// 数据缓存
state.cacheLoading = {};
state.cacheDrawerOverlay = [];
// User
state.cacheUserActive = {};
state.cacheUserWait = [];