Browse Source

fix: 修改tag右键操作异常

main
xuziqiang 5 months ago
parent
commit
7c64a6b231
  1. 44
      lib/saas/view/system/layout/tags.vue

44
lib/saas/view/system/layout/tags.vue

@ -14,10 +14,21 @@
<div class="fatherTags"> <div class="fatherTags">
<ul id="tag-list" ref="tags"> <ul id="tag-list" ref="tags">
<div v-for="(item, index) in tagList" :key="index" @click="clickTag(item)"> <div v-for="(item, index) in tagList" :key="index" @click="clickTag(item)">
<li <li :id="selectTags.path === item.path ? 'ischoice' : ''">
@click.right="openMenu($event, index)" <a-dropdown :trigger="['contextmenu']" @visibleChange="(v) => visibleChange(v, item)">
:id="selectTags.path === item.path ? 'ischoice' : ''"> <span>
<span>{{ isdisabledl || isdisabledr ? item.title.substring(0, 4) : item.title }}</span> {{ isdisabledl || isdisabledr ? item.title.substring(0, 4) : item.title }}
</span>
<template #overlay>
<a-menu>
<a-menu-item key="1"> <li @click="closeAllMenu">关闭所有标签页</li></a-menu-item>
<a-menu-item key="2">
<li @click="closeOhterMenu">关闭其他标签页</li>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
<ns-icon <ns-icon
v-if="item.path !== baseHeader.redirect" v-if="item.path !== baseHeader.redirect"
name="close" name="close"
@ -33,10 +44,10 @@
name="fastBackward" name="fastBackward"
class="icon_kt" /> class="icon_kt" />
</div> </div>
<ul v-show="visible" :style="{ left: left + 'px', top: top + 'px' }" class="contextmenu"> <!-- <ul v-show="visible" :style="{ left: left + 'px', top: top + 'px' }" class="contextmenu">
<li @click="closeAllMenu">关闭所有标签页</li> <li @click="closeAllMenu">关闭所有标签页</li>
<li @click="closeOhterMenu">关闭其他标签页</li> <li @click="closeOhterMenu">关闭其他标签页</li>
</ul> </ul> -->
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -54,11 +65,11 @@
const visible = ref<boolean>(false); const visible = ref<boolean>(false);
const leftMenuTrigger = ref(false); const leftMenuTrigger = ref(false);
mittEmit.on('leftMenuTrigger', (val) => { mittEmit.on('leftMenuTrigger', (val) => {
console.log('leftMenuTrigger', val);
leftMenuTrigger.value = val; leftMenuTrigger.value = val;
}); });
// const tagList = ref<tagsClass[]>([]); // const tagList = ref<tagsClass[]>([]);
const rightNumber = ref<number>(0); const rightNumber = ref<number>(0);
const rightTarget = ref();
const tagsStore = useTags(); const tagsStore = useTags();
const router = useRouter(); const router = useRouter();
const keepAliveStore = useKeepAlive(); const keepAliveStore = useKeepAlive();
@ -68,13 +79,15 @@
const tagList = computed(() => tagsStore.getTags); const tagList = computed(() => tagsStore.getTags);
// //
const closeAllMenu = () => { const closeAllMenu = () => {
tagsStore.sliceTags(0); // tagsStore.sliceTags(0);
tagsStore.clearTags();
}; };
// //
const closeOhterMenu = () => { const closeOhterMenu = () => {
let choicetag = tagList.value[rightNumber.value]; // let choicetag = tagList.value[rightNumber.value];
tagsStore.sliceTags(0); tagsStore.clearTags();
tagsStore.addTags(choicetag); tagsStore.addTags(rightTarget.value);
clickTag(rightTarget.value);
}; };
const selectTags = inject('selectTags'); const selectTags = inject('selectTags');
console.log(selectTags); console.log(selectTags);
@ -94,7 +107,11 @@
}); });
} }
}; };
const visibleChange = (visible, target) => {
if (visible) rightTarget.value = target;
};
return { return {
visibleChange,
leftMenuTrigger, leftMenuTrigger,
router, router,
clickTag, clickTag,
@ -287,11 +304,11 @@
align-items: center; align-items: center;
position: fixed; position: fixed;
top: @layout-header-height; top: @layout-header-height;
z-index: 2; z-index: 6;
border-bottom: 1px solid rgba(0, 0, 0, 0.05); border-bottom: 1px solid rgba(0, 0, 0, 0.05);
} }
.nav-shutters-collapsed { .nav-shutters-collapsed {
width: calc(100% - 40px); width: calc(100% - @layout-sider-collapsed-width);
// padding: 0 12px; // padding: 0 12px;
min-height: @ns-nav-shutters-height; min-height: @ns-nav-shutters-height;
height: @ns-nav-shutters-height; height: @ns-nav-shutters-height;
@ -301,6 +318,7 @@
position: fixed; position: fixed;
top: @layout-header-height; top: @layout-header-height;
z-index: 10; z-index: 10;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
} }
.nav-shutters-container { .nav-shutters-container {
display: flex; display: flex;

Loading…
Cancel
Save