Add retap triggers, which is currently no use

This commit is contained in:
NI
2019-09-09 22:52:06 +08:00
parent ac3278f974
commit 797f4fd89c
6 changed files with 32 additions and 8 deletions

View File

@@ -80,6 +80,8 @@ class Control {
this.enable = false; this.enable = false;
} }
retap() {}
receive() { receive() {
return this.subs.subscribe(); return this.subs.subscribe();
} }

View File

@@ -399,6 +399,8 @@ class Control {
this.enable = false; this.enable = false;
} }
retap() {}
receive() { receive() {
return this.subs.subscribe(); return this.subs.subscribe();
} }

View File

@@ -51,6 +51,7 @@
tabs-class="tab1" tabs-class="tab1"
list-trigger-class="icon icon-more1" list-trigger-class="icon icon-more1"
@current="switchTab" @current="switchTab"
@retap="retapTab"
@list="showTabsWindow" @list="showTabsWindow"
@close="closeTab" @close="closeTab"
></tabs> ></tabs>
@@ -135,6 +136,7 @@
tabs-class="tab1 tab1-list" tabs-class="tab1 tab1-list"
@display="windows.tabs = $event" @display="windows.tabs = $event"
@current="switchTab" @current="switchTab"
@retap="retapTab"
@close="closeTab" @close="closeTab"
></tab-window></div ></tab-window></div
></template> ></template>
@@ -472,6 +474,9 @@ export default {
this.tab.tabs[this.tab.current].indicator.updated = false; this.tab.tabs[this.tab.current].indicator.updated = false;
await this.tab.tabs[this.tab.current].control.enabled(); await this.tab.tabs[this.tab.current].control.enabled();
}, },
async retapTab(tab) {
await this.tab.tabs[tab].control.retap();
},
async closeTab(index) { async closeTab(index) {
if (this.tab.tabs[index].status.closing) { if (this.tab.tabs[index].status.closing) {
return; return;

View File

@@ -33,9 +33,9 @@
? tabInfo.control.activeColor() ? tabInfo.control.activeColor()
: tabInfo.control.color()) : tabInfo.control.color())
" "
@click="switchTo(idx)" @click.self="switchTab(idx)"
> >
<span class="title" :title="tabInfo.name"> <span class="title" :title="tabInfo.name" @click="switchTab(idx)">
<span <span
class="type" class="type"
:title="tabInfo.info.name()" :title="tabInfo.info.name()"
@@ -60,7 +60,7 @@ export default {
}, },
tab: { tab: {
type: Number, type: Number,
default: 0 default: -1
}, },
tabs: { tabs: {
type: Array, type: Array,
@@ -73,18 +73,18 @@ export default {
}, },
watch: { watch: {
tab(newVal) { tab(newVal) {
this.switchTo(newVal); this.switchTabTo(newVal);
}, },
tabs(newVal) { tabs(newVal) {
if (newVal.length > this.tab) { if (newVal.length > this.tab) {
return; return;
} }
this.switchTo(newVal.length - 1); this.switchTabTo(newVal.length - 1);
} }
}, },
methods: { methods: {
switchTo(index) { switchTabTo(index) {
if (index < 0 || index >= this.tabs.length) { if (index < 0 || index >= this.tabs.length) {
return; return;
} }
@@ -95,6 +95,19 @@ export default {
this.$emit("current", index); this.$emit("current", index);
}, },
switchTab(index) {
if (index < 0 || index >= this.tabs.length) {
return;
}
if (this.tab === index) {
this.$emit("retap", index);
return;
}
return this.switchTabTo(index);
},
closeAt(index) { closeAt(index) {
this.$emit("close", index); this.$emit("close", index);
} }

View File

@@ -32,6 +32,7 @@
:tabs="tabs" :tabs="tabs"
:tabs-class="tabsClass" :tabs-class="tabsClass"
@current="$emit('current', $event)" @current="$emit('current', $event)"
@retap="$emit('retap', $event)"
@close="$emit('close', $event)" @close="$emit('close', $event)"
></tab-list> ></tab-list>
</window> </window>
@@ -55,7 +56,7 @@ export default {
}, },
tab: { tab: {
type: Number, type: Number,
default: 0 default: -1
}, },
tabs: { tabs: {
type: Array, type: Array,

View File

@@ -25,6 +25,7 @@
:tabs="tabs" :tabs="tabs"
:tabs-class="tabsClass" :tabs-class="tabsClass"
@current="$emit('current', $event)" @current="$emit('current', $event)"
@retap="$emit('retap', $event)"
@close="$emit('close', $event)" @close="$emit('close', $event)"
></tab-list> ></tab-list>
@@ -52,7 +53,7 @@ export default {
}, },
tab: { tab: {
type: Number, type: Number,
default: 0 default: -1
}, },
tabs: { tabs: {
type: Array, type: Array,