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;
}
retap() {}
receive() {
return this.subs.subscribe();
}

View File

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

View File

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

View File

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

View File

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

View File

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