From 87b8f7e7c0c46721ed1d13d422a356df77a61284 Mon Sep 17 00:00:00 2001 From: fofolee Date: Thu, 7 Apr 2022 21:37:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=8F=AF=E6=94=B6?= =?UTF-8?q?=E7=BC=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandEditor.vue | 51 +++++++++++++++++++++++++++----- src/components/CommandMenu.vue | 7 +---- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/components/CommandEditor.vue b/src/components/CommandEditor.vue index 1b8095f..18c59c2 100644 --- a/src/components/CommandEditor.vue +++ b/src/components/CommandEditor.vue @@ -6,9 +6,10 @@ :quickcommandInfo="quickcommandInfo" class="absolute-left shadow-10" :style="{ - width: sideBarWidth, + width: sideBarWidth + 'px', background: $q.dark.isActive ? '#2d2d2d' : '#f2f2f2', zIndex: 1, + transition: '0.3s', }" v-if="showSidebar" > @@ -16,10 +17,30 @@
+
+ {{ sideBarWidth ? "收起" : "展开" }}侧栏 +
@@ -159,8 +181,8 @@ export default { data() { return { programLanguages: Object.keys(this.$programmings), - sideBarWidth: "290px", - languageBarHeight: "40px", + sideBarWidth: 250, + languageBarHeight: 40, canCommandSave: this.action.type === "code" ? false : true, quickcommandInfo: { features: { @@ -202,8 +224,11 @@ export default { }, computed: { allQuickCommandTags() { - return this.parent.allQuickCommandTags.filter( - (x) => x !== "默认" && x !== "未分类" && x !== "搜索结果" + return _.without( + this.parent.allQuickCommandTags, + "默认", + "未分类", + "搜索结果" ); }, }, @@ -293,6 +318,16 @@ export default { ] = res; }); }, + // 展开收起侧栏 + toggleSideBarWidth() { + if (this.sideBarWidth) { + this.lastSideBarWidth = this.sideBarWidth; + this.sideBarWidth = 0; + } else { + this.sideBarWidth = this.lastSideBarWidth; + this.lastSideBarWidth = 0; + } + }, // 自定义解释器路径界面 showCustomOptions() { quickcommand diff --git a/src/components/CommandMenu.vue b/src/components/CommandMenu.vue index 83473cb..5ad936a 100644 --- a/src/components/CommandMenu.vue +++ b/src/components/CommandMenu.vue @@ -256,12 +256,7 @@ export default { outputTypes: outputTypes, outputTypesOptions: Object.keys(outputTypes), specialVar: "{{}}", - allQuickCommandTags: _.without( - this.$parent.parent.allQuickCommandTags, - "默认", - "未分类", - "搜索结果" - ), + allQuickCommandTags: this.$parent.allQuickCommandTags, }; }, props: {