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

View File

@ -15,6 +15,8 @@
</template> </template>
<script> <script>
import state from "../store/state";
export default { export default {
name: 'DrawerOverlay', name: 'DrawerOverlay',
props: { 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: { methods: {
mask () { mask () {
if (this.maskClosable) { if (this.maskClosable) {

View File

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