refine
This commit is contained in:
parent
2bae8af043
commit
e3477a29be
|
@ -7,9 +7,9 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</scroll-pane>
|
</scroll-pane>
|
||||||
<ul class='contextmenu' v-show="visible" :style="{left:left+'px',top:top+'px'}">
|
<ul class='contextmenu' v-show="visible" :style="{left:left+'px',top:top+'px'}">
|
||||||
<li @click="closePage(0,$event)">关闭</li>
|
<li @click="closeViewTags(selectedTag, $event)">关闭</li>
|
||||||
<li @click="closePage(1,$event)">关闭其他</li>
|
<li @click="closeOtherTags">关闭其他</li>
|
||||||
<li @click="closePage(2,$event)">关闭所有</li>
|
<li @click="closeAllTags">关闭所有</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
visible: false,
|
visible: false,
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
isSelect: {}
|
selectedTag: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -51,18 +51,13 @@
|
||||||
})
|
})
|
||||||
$event.preventDefault()
|
$event.preventDefault()
|
||||||
},
|
},
|
||||||
closePage(flag, $event) {
|
closeOtherTags() {
|
||||||
if (flag === 0) {
|
this.$router.push(this.selectedTag.path)
|
||||||
this.closeViewTags(this.isSelect, $event)
|
this.$store.dispatch('delOtherViews', this.selectedTag)
|
||||||
} else if (flag === 1) {
|
},
|
||||||
this.$router.push(this.isSelect.path)
|
closeAllTags() {
|
||||||
this.$store.dispatch('delOtherViews', this.isSelect)
|
|
||||||
$event.preventDefault()
|
|
||||||
} else {
|
|
||||||
this.$store.dispatch('delAllViews')
|
this.$store.dispatch('delAllViews')
|
||||||
this.$router.push('/')
|
this.$router.push('/')
|
||||||
$event.preventDefault()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
generateRoute() {
|
generateRoute() {
|
||||||
if (this.$route.name) {
|
if (this.$route.name) {
|
||||||
|
@ -93,9 +88,12 @@
|
||||||
},
|
},
|
||||||
openMenu(tag, e) {
|
openMenu(tag, e) {
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.isSelect = tag
|
this.selectedTag = tag
|
||||||
this.left = e.clientX
|
this.left = e.clientX
|
||||||
this.top = e.clientY
|
this.top = e.clientY
|
||||||
|
},
|
||||||
|
closeMenu() {
|
||||||
|
this.visible = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -105,11 +103,9 @@
|
||||||
},
|
},
|
||||||
visible(v) {
|
visible(v) {
|
||||||
if (v) {
|
if (v) {
|
||||||
window.addEventListener('click', () => {
|
window.addEventListener('click', this.closeMenu, false)
|
||||||
this.visible = false
|
|
||||||
}, false)
|
|
||||||
} else {
|
} else {
|
||||||
window.removeEventListener('click')
|
window.removeEventListener('click', this.closeMenu, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue