邓洁 : 标签关闭当前和关闭其他功能
This commit is contained in:
@@ -35,15 +35,13 @@ const props = defineProps({
|
||||
required: true
|
||||
}
|
||||
})
|
||||
console.log(props.menuItem)
|
||||
const link = ref('http://web-tunnel.feashow.com/api/doc.html#/home')
|
||||
const link = ref('http://gateway.feashow.cn/doc.html#/home')
|
||||
const handleGo = (path) => {
|
||||
if (path === "/tool/swagger") {
|
||||
return ''
|
||||
} else {
|
||||
return path
|
||||
}
|
||||
// window.open(path)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</router-link>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
<ul class="el-dropdown-menu contextmenu" :style="{ 'left': left + 'px', 'top': top + 'px' }" v-if="visible">
|
||||
<ul class=" contextmenu" :style="{ 'left': left + 'px' }" v-if="visible">
|
||||
<li class="el-dropdown-menu__item" @click="closeCurrentTagView">关闭当前</li>
|
||||
<li class="el-dropdown-menu__item" @click="closeOtherTagView">关闭其他</li>
|
||||
</ul>
|
||||
@@ -31,7 +31,7 @@ const route = useRoute()
|
||||
const tagsViewStore = useTagsView()
|
||||
const visible = ref(false)
|
||||
const left = ref()
|
||||
const top = ref()
|
||||
const tagPath = ref()
|
||||
|
||||
watch(route, () => {
|
||||
init()
|
||||
@@ -46,19 +46,18 @@ const isActive = (tag) => {
|
||||
return tag.path === route.path
|
||||
}
|
||||
const openMenu = (tag, e) => {
|
||||
console.log(tag, e);
|
||||
left.value = e.x + 10
|
||||
top.value = e.y + 10
|
||||
tagPath.value=tag
|
||||
left.value = e.x-230
|
||||
visible.value = true
|
||||
}
|
||||
// 关闭当前
|
||||
const closeCurrentTagView = () => {
|
||||
tagsViewStore.delVisitedViews(route.path)
|
||||
tagsViewStore.delVisitedViews(tagPath.value.path)
|
||||
visible.value = false
|
||||
}
|
||||
// 关闭其他
|
||||
const closeOtherTagView = () => {
|
||||
tagsViewStore.delOtherVisitedViews(route)
|
||||
tagsViewStore.delOtherVisitedViews(tagPath.value)
|
||||
visible.value = false
|
||||
}
|
||||
init()
|
||||
@@ -66,6 +65,7 @@ init()
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.link-box {
|
||||
position: relative;
|
||||
padding: 12px 0;
|
||||
line-height: 30px;
|
||||
|
||||
@@ -89,14 +89,18 @@ init()
|
||||
}
|
||||
|
||||
.contextmenu {
|
||||
padding: 5px;
|
||||
width: 88px;
|
||||
//height: 82px;
|
||||
position: absolute;
|
||||
top:47px;
|
||||
z-index: 3000;
|
||||
background: #fff;
|
||||
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
|
||||
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 7px 16px;
|
||||
padding: 7px 10px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
|
||||
@@ -37,6 +37,7 @@ export const useTagsView = defineStore('tagsView',()=>{
|
||||
const delOtherVisitedViews = ({path,meta}) => {
|
||||
visitedViews.value = []
|
||||
visitedViews.value.push({path,meta})
|
||||
toLastTagView(visitedViews)
|
||||
}
|
||||
|
||||
//路由到末尾标签页
|
||||
|
||||
Reference in New Issue
Block a user