diff --git a/src/components/TreeSelect/index.vue b/src/components/TreeSelect/index.vue index 51161ff8..27a56fcc 100644 --- a/src/components/TreeSelect/index.vue +++ b/src/components/TreeSelect/index.vue @@ -84,9 +84,7 @@ const defaultExpandedKey = ref([]); function initHandle() { nextTick(() => { - console.log("selectedValue1", modelValue) const selectedValue = modelValue.value; - console.log("selectedValue", modelValue.value) if (selectedValue !== null && typeof (selectedValue) !== "undefined") { const node = proxy.$refs.selectTree.getNode(selectedValue) if (node) { diff --git a/src/components/Upload/SingleUpload.vue b/src/components/Upload/SingleUpload.vue index bb825a68..ff66f0e6 100644 --- a/src/components/Upload/SingleUpload.vue +++ b/src/components/Upload/SingleUpload.vue @@ -30,7 +30,7 @@ diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index 4ce7c6af..aa6e8a3f 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -53,7 +53,7 @@ const props = defineProps({ } }) -const onlyOneChild = ref({}); +const onlyOneChild = ref(); function hasOneShowingChild(children = [] as any, parent: RouteRecordRaw) { if (!children) { diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 934e455b..78ed559e 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -18,22 +18,28 @@
@@ -68,7 +74,7 @@ const routes = computed(() => usePermissionStoreHook().routes) const affixTags = ref([]); const visible = ref(false); const selectedTag = ref({}); -const scrollPaneRef = ref(null); +const scrollPaneRef = ref(); const left = ref(0); const top = ref(0); @@ -173,15 +179,13 @@ function refreshSelectedTag(view: TagView) { tagsViewStoreHook().delCachedView(view) const {fullPath} = view nextTick(() => { - - console.log('fullPath',fullPath) router.replace({path: '/redirect' + fullPath}).catch(err => { console.warn(err) }) }) } -function toLastView(visitedViews: TagView[], view: TagView) { +function toLastView(visitedViews: TagView[], view?: any) { const latestView = visitedViews.slice(-1)[0] if (latestView && latestView.fullPath) { router.push(latestView.fullPath) @@ -198,29 +202,44 @@ function toLastView(visitedViews: TagView[], view: TagView) { } function closeSelectedTag(view: TagView) { - tagsViewStoreHook().delView(view).then(({visitedViews}) => { + tagsViewStoreHook().delView(view).then((res: any) => { if (isActive(view)) { - toLastView(visitedViews, view) + toLastView(res.visitedViews, view) } }) } function closeLeftTags() { - tagsViewStoreHook().delLeftViews(selectedTag.value).then(({visitedViews}) => { - if (!visitedViews.find(i => i.fullPath === route.fullPath)) { - toLastView(visitedViews) + tagsViewStoreHook().delLeftViews(selectedTag.value).then((res: any) => { + if (!res.visitedViews.find((item: any) => item.fullPath === route.fullPath)) { + toLastView(res.visitedViews) + } + }) +} +function closeRightTags() { + tagsViewStoreHook().delRightViews(selectedTag.value).then((res:any) => { + if (!res.visitedViews.find((item:any) => item.fullPath === route.fullPath)) { + toLastView(res.visitedViews) } }) } -function closeRightTags() { - tagsViewStoreHook().delRightViews(selectedTag.value).then(({visitedViews}) => { - if (!visitedViews.find(i => i.fullPath === route.fullPath)) { - toLastView(visitedViews) - } +function closeOtherTags() { + tagsViewStoreHook().delOtherViews(selectedTag.value).then(() => { + moveToCurrentTag() }) } +function closeAllTags(view: TagView) { + tagsViewStoreHook().delRightViews(selectedTag.value).then((res:any) => { + if (affixTags.value.some((tag:any) => tag.path === route.path)) { + return + } + toLastView(res.visitedViews, view) + }) +} + + function openMenu(tag: TagView, e: MouseEvent) { const menuMinWidth = 105 const offsetLeft = ctx.$el.getBoundingClientRect().left // container margin left @@ -261,6 +280,7 @@ onMounted(() => { background: #fff; border-bottom: 1px solid #d8dce5; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04); + .tags-view-wrapper { .tags-view-item { display: inline-block; @@ -275,16 +295,20 @@ onMounted(() => { font-size: 12px; margin-left: 5px; margin-top: 4px; + &:first-of-type { margin-left: 15px; } + &:last-of-type { margin-right: 15px; } + &.active { background-color: #42b983; color: #fff; border-color: #42b983; + &::before { content: ""; background: #fff; @@ -298,6 +322,7 @@ onMounted(() => { } } } + .contextmenu { margin: 0; background: #fff; @@ -310,10 +335,12 @@ onMounted(() => { font-weight: 400; color: #333; box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3); + li { margin: 0; padding: 7px 16px; cursor: pointer; + &:hover { background: #eee; } @@ -334,11 +361,13 @@ onMounted(() => { text-align: center; transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); transform-origin: 100% 50%; + &:before { transform: scale(0.6); display: inline-block; vertical-align: -3px; } + &:hover { background-color: #b4bccc; color: #fff; diff --git a/src/store/interface.ts b/src/store/interface.ts index 352e6fa1..b1a78410 100644 --- a/src/store/interface.ts +++ b/src/store/interface.ts @@ -38,7 +38,7 @@ export interface TagView extends Partial