forked from liweijie/education
1 line
30 KiB
JSON
1 line
30 KiB
JSON
{"remainingRequest":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!C:\\Users\\Admin\\Desktop\\education\\frontend\\src\\layout\\components\\TagsView\\index.vue?vue&type=style&index=1&id=fac8ca64&lang=scss","dependencies":[{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\src\\layout\\components\\TagsView\\index.vue","mtime":1787567993823},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\css-loader\\dist\\cjs.js","mtime":1787309792478},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\vue-loader\\lib\\loaders\\stylePostLoader.js","mtime":1787309794547},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\postcss-loader\\src\\index.js","mtime":1787309793084},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\sass-loader\\dist\\cjs.js","mtime":1787309791955},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1787309791955},{"path":"C:\\Users\\Admin\\Desktop\\education\\frontend\\node_modules\\vue-loader\\lib\\index.js","mtime":1787309793790}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoK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AgICAgIA0KICAgICAgJjo6LXdlYmtpdC1zY3JvbGxiYXItdHJhY2sgew0KICAgICAgICBiYWNrZ3JvdW5kOiB0cmFuc3BhcmVudDsNCiAgICAgIH0NCiAgICAgIA0KICAgICAgJjo6LXdlYmtpdC1zY3JvbGxiYXItdGh1bWIgew0KICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZ2JhKDAsIDAsIDAsIDAuMik7DQogICAgICAgIGJvcmRlci1yYWRpdXM6IDNweDsNCiAgICAgICAgdHJhbnNpdGlvbjogYmFja2dyb3VuZC1jb2xvciAwLjJzOw0KICAgICAgICANCiAgICAgICAgJjpob3ZlciB7DQogICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgwLCAwLCAwLCAwLjQpOw0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICAgIA0KICAgIHNjcm9sbGJhci13aWR0aDogbm9uZTsNCiAgICAtbXMtb3ZlcmZsb3ctc3R5bGU6IG5vbmU7DQogIH0NCg0KICAuZWwtc2Nyb2xsYmFyX19iYXIgew0KICAgIG9wYWNpdHk6IDA7DQogICAgdHJhbnNpdGlvbjogb3BhY2l0eSAwLjNzOw0KICAgIHotaW5kZXg6IDEwOw0KDQogICAgLnRhZ3Mtdmlldy1jb250YWluZXI6aG92ZXIgJiB7DQogICAgICBvcGFjaXR5OiAxOw0KICAgIH0NCiAgfQ0KDQogIC50YWdzLXZpZXctY29udGFpbmVyLS1jaHJvbWUgJiB7DQogICAgLmVsLXNjcm9sbGJhciB7DQogICAgICBwb3NpdGlvbjogcmVsYXRpdmU7DQogICAgfQ0KDQogICAgLmVsLXNjcm9sbGJhcl9fd3JhcCB7DQogICAgICAmOjotd2Via2l0LXNjcm9sbGJhciB7DQogICAgICAgIHdpZHRoOiAwICFpbXBvcnRhbnQ7DQogICAgICAgIGhlaWdodDogMCAhaW1wb3J0YW50Ow0KICAgICAgfQ0KICAgICAgc2Nyb2xsYmFyLXdpZHRoOiBub25lOw0KICAgICAgL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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAknBA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.vue","sourceRoot":"src/layout/components/TagsView","sourcesContent":["<template>\r\n <div id=\"tags-view-container\" class=\"tags-view-container\">\r\n <!-- 左切换箭头 -->\r\n <span class=\"tags-nav-btn tags-nav-btn--left\" :class=\"{ disabled: !canScrollLeft }\" @click=\"scrollLeft\">\r\n <i class=\"el-icon-arrow-left\" />\r\n </span>\r\n\r\n <!-- 标签滚动区 -->\r\n <scroll-pane ref=\"scrollPane\" class=\"tags-view-wrapper\" @scroll=\"handleScroll\" @updateArrows=\"updateArrowState\">\r\n <router-link\r\n v-for=\"tag in visitedViews\"\r\n ref=\"tag\"\r\n :key=\"tag.path\"\r\n :class=\"{ 'active': isActive(tag) }\"\r\n :to=\"{ path: tag.path, query: tag.query, fullPath: tag.fullPath }\"\r\n tag=\"span\"\r\n class=\"tags-view-item\"\r\n :style=\"tagActiveStyle(tag)\"\r\n @click.middle.native=\"!isAffix(tag) ? closeSelectedTag(tag) : ''\"\r\n @contextmenu.prevent.native=\"openMenu(tag, $event)\"\r\n >\r\n {{ tag.title }}\r\n <span v-if=\"!isAffix(tag)\" class=\"el-icon-close\" @click.prevent.stop=\"closeSelectedTag(tag)\" />\r\n </router-link>\r\n </scroll-pane>\r\n\r\n <!-- 右切换箭头 -->\r\n <span class=\"tags-nav-btn tags-nav-btn--right\" :class=\"{ disabled: !canScrollRight }\" @click=\"scrollRight\">\r\n <i class=\"el-icon-arrow-right\" />\r\n </span>\r\n\r\n <!-- 下拉操作菜单 -->\r\n <el-dropdown class=\"tags-action-dropdown\" trigger=\"click\" placement=\"bottom-end\" @command=\"handleDropdownCommand\">\r\n <span class=\"tags-action-btn\">\r\n <i class=\"el-icon-arrow-down\" />\r\n </span>\r\n <el-dropdown-menu slot=\"dropdown\" class=\"tags-dropdown-menu\">\r\n <el-dropdown-item v-if=\"!isAffix(selectedDropdownTag)\" command=\"close\" icon=\"el-icon-close\">关闭当前</el-dropdown-item>\r\n <el-dropdown-item command=\"closeOthers\" icon=\"el-icon-circle-close\">关闭其他</el-dropdown-item>\r\n <el-dropdown-item command=\"closeLeft\" :disabled=\"isFirstView()\" icon=\"el-icon-back\">关闭左侧</el-dropdown-item>\r\n <el-dropdown-item command=\"closeRight\" :disabled=\"isLastView()\" icon=\"el-icon-right\">关闭右侧</el-dropdown-item>\r\n <el-dropdown-item command=\"closeAll\" icon=\"el-icon-circle-close\">全部关闭</el-dropdown-item>\r\n <el-dropdown-item command=\"fullscreen\" divided>\r\n <template v-if=\"!isFullscreen\"><i class=\"el-icon-full-screen\"></i>全屏显示</template>\r\n <template v-else><i class=\"el-icon-close\"></i>退出全屏</template>\r\n </el-dropdown-item>\r\n </el-dropdown-menu>\r\n </el-dropdown>\r\n\r\n <!-- 刷新按钮 -->\r\n <span class=\"tags-action-btn tags-refresh-btn\" title=\"刷新页面\" @click=\"refreshSelectedTag(selectedDropdownTag)\">\r\n <i class=\"el-icon-refresh-right\" /> 刷新\r\n </span>\r\n\r\n <!-- 右键上下文菜单 -->\r\n <ul v-show=\"visible\" :style=\"{ left: left + 'px', top: top + 'px' }\" class=\"contextmenu\">\r\n <li @click=\"refreshSelectedTag(selectedTag)\"><i class=\"el-icon-refresh-right\"></i> 刷新页面</li>\r\n <li v-if=\"!isAffix(selectedTag)\" @click=\"closeSelectedTag(selectedTag)\"><i class=\"el-icon-close\"></i> 关闭当前</li>\r\n <li @click=\"closeOthersTags\"><i class=\"el-icon-circle-close\"></i> 关闭其他</li>\r\n <li v-if=\"!isFirstView()\" @click=\"closeLeftTags\"><i class=\"el-icon-back\"></i> 关闭左侧</li>\r\n <li v-if=\"!isLastView()\" @click=\"closeRightTags\"><i class=\"el-icon-right\"></i> 关闭右侧</li>\r\n <li @click=\"closeAllTags(selectedTag)\"><i class=\"el-icon-circle-close\"></i> 全部关闭</li>\r\n </ul>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport ScrollPane from './ScrollPane'\r\nimport path from 'path'\r\n\r\nexport default {\r\n components: { ScrollPane },\r\n data() {\r\n return {\r\n visible: false,\r\n top: 0,\r\n left: 0,\r\n selectedTag: {},\r\n affixTags: [],\r\n canScrollLeft: false,\r\n canScrollRight: false,\r\n isFullscreen: false,\r\n hiddenElements: []\r\n }\r\n },\r\n computed: {\r\n visitedViews() {\r\n return this.$store.state.tagsView.visitedViews\r\n },\r\n routes() {\r\n return this.$store.state.permission.routes\r\n },\r\n selectedDropdownTag() {\r\n return this.visitedViews.find(v => this.isActive(v)) || {}\r\n }\r\n },\r\n watch: {\r\n $route() {\r\n this.addTags()\r\n this.moveToCurrentTag()\r\n },\r\n visible(value) {\r\n if (value) {\r\n document.body.addEventListener('click', this.closeMenu)\r\n } else {\r\n document.body.removeEventListener('click', this.closeMenu)\r\n }\r\n },\r\n visitedViews() {\r\n this.$nextTick(() => {\r\n this.updateArrowState()\r\n })\r\n }\r\n },\r\n mounted() {\r\n this.initTags()\r\n this.addTags()\r\n window.addEventListener('resize', this.updateArrowState)\r\n window.addEventListener('keydown', this.handleKeyDown)\r\n },\r\n beforeDestroy() {\r\n window.removeEventListener('resize', this.updateArrowState)\r\n window.removeEventListener('keydown', this.handleKeyDown)\r\n },\r\n methods: {\r\n handleKeyDown(event) {\r\n // 当按下Esc键且处于全屏状态时,退出全屏\r\n if (event.key === 'Escape' && this.isFullscreen) {\r\n this.toggleFullscreen()\r\n }\r\n },\r\n isActive(route) {\r\n return route.path === this.$route.path\r\n },\r\n tagActiveStyle(tag) {\r\n if (!this.isActive(tag)) return {}\r\n return {\r\n \"background-color\": \"#e8f3ef\",\r\n \"border-color\": \"#0b6b55\"\r\n }\r\n },\r\n isAffix(tag) {\r\n return tag && tag.meta && tag.meta.affix\r\n },\r\n isFirstView() {\r\n try {\r\n const tag = this.selectedTag && this.selectedTag.fullPath ? this.selectedTag : this.selectedDropdownTag\r\n return tag.fullPath === '/index' || tag.fullPath === this.visitedViews[1].fullPath\r\n } catch (err) {\r\n return false\r\n }\r\n },\r\n isLastView() {\r\n try {\r\n const tag = this.selectedTag && this.selectedTag.fullPath ? this.selectedTag : this.selectedDropdownTag\r\n return tag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath\r\n } catch (err) {\r\n return false\r\n }\r\n },\r\n filterAffixTags(routes, basePath = '/') {\r\n let tags = []\r\n routes.forEach(route => {\r\n if (route.meta && route.meta.affix) {\r\n const tagPath = path.resolve(basePath, route.path)\r\n tags.push({\r\n fullPath: tagPath,\r\n path: tagPath,\r\n name: route.name,\r\n meta: { ...route.meta }\r\n })\r\n }\r\n if (route.children) {\r\n const tempTags = this.filterAffixTags(route.children, route.path)\r\n if (tempTags.length >= 1) {\r\n tags = [...tags, ...tempTags]\r\n }\r\n }\r\n })\r\n return tags\r\n },\r\n initTags() {\r\n const affixTags = this.affixTags = this.filterAffixTags(this.routes)\r\n for (const tag of affixTags) {\r\n if (tag.name) {\r\n this.$store.dispatch('tagsView/addAffixView', tag)\r\n }\r\n }\r\n },\r\n addTags() {\r\n const { name } = this.$route\r\n if (name) {\r\n this.$store.dispatch('tagsView/addView', this.$route)\r\n }\r\n },\r\n moveToCurrentTag() {\r\n const tags = this.$refs.tag\r\n this.$nextTick(() => {\r\n for (const tag of tags) {\r\n if (tag.to.path === this.$route.path) {\r\n this.$refs.scrollPane.moveToTarget(tag)\r\n if (tag.to.fullPath !== this.$route.fullPath) {\r\n this.$store.dispatch('tagsView/updateVisitedView', this.$route)\r\n }\r\n break\r\n }\r\n }\r\n })\r\n },\r\n scrollLeft() {\r\n if (!this.canScrollLeft) return\r\n this.$refs.scrollPane.scrollToStart()\r\n },\r\n scrollRight() {\r\n if (!this.canScrollRight) return\r\n this.$refs.scrollPane.scrollToEnd()\r\n },\r\n updateArrowState() {\r\n this.$nextTick(() => {\r\n if (this.$refs.scrollPane) {\r\n const state = this.$refs.scrollPane.getScrollState()\r\n this.canScrollLeft = state.canLeft\r\n this.canScrollRight = state.canRight\r\n }\r\n })\r\n },\r\n toggleFullscreen() {\r\n const mainContainer = document.querySelector('.main-container')\r\n const navbar = document.querySelector('.navbar')\r\n const sidebar = document.querySelector('.sidebar-container')\r\n if (!mainContainer) return\r\n\r\n if (!this.isFullscreen) {\r\n mainContainer.classList.add('fullscreen-mode')\r\n document.body.style.overflow = 'hidden'\r\n const elementsToHide = [\r\n { el: navbar, originalDisplay: (navbar && navbar.style.display) || '' }, \r\n { el: sidebar, originalDisplay: (sidebar && sidebar.style.display) || '' }\r\n ]\r\n elementsToHide.forEach(item => {\r\n if (item.el && item.el.style.display !== 'none') {\r\n item.originalDisplay = item.el.style.display\r\n item.el.style.display = 'none'\r\n this.hiddenElements.push(item)\r\n }\r\n })\r\n this.isFullscreen = true\r\n } else {\r\n mainContainer.classList.remove('fullscreen-mode')\r\n document.body.style.overflow = ''\r\n this.hiddenElements.forEach(item => {\r\n if (item.el) {\r\n item.el.style.display = item.originalDisplay\r\n }\r\n })\r\n this.hiddenElements = []\r\n const btn = document.querySelector('.tags-action-btn')\r\n if (btn) btn.blur()\r\n this.isFullscreen = false\r\n }\r\n },\r\n handleDropdownCommand(command) {\r\n const tag = this.selectedDropdownTag\r\n this.selectedTag = tag\r\n switch (command) {\r\n case 'refresh':\r\n this.refreshSelectedTag(tag)\r\n break\r\n case 'fullscreen':\r\n this.toggleFullscreen()\r\n break\r\n case 'close':\r\n this.closeSelectedTag(tag)\r\n break\r\n case 'closeOthers':\r\n this.closeOthersTags()\r\n break\r\n case 'closeLeft':\r\n this.closeLeftTags()\r\n break\r\n case 'closeRight':\r\n this.closeRightTags()\r\n break\r\n case 'closeAll':\r\n this.closeAllTags(tag)\r\n break\r\n }\r\n },\r\n refreshSelectedTag(view) {\r\n this.$tab.refreshPage(view)\r\n if (this.$route.meta.link) {\r\n this.$store.dispatch('tagsView/delIframeView', this.$route)\r\n }\r\n },\r\n closeSelectedTag(view) {\r\n this.$tab.closePage(view).then(({ visitedViews }) => {\r\n if (this.isActive(view)) {\r\n this.toLastView(visitedViews, view)\r\n }\r\n })\r\n },\r\n closeRightTags() {\r\n this.$tab.closeRightPage(this.selectedTag).then(visitedViews => {\r\n if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {\r\n this.toLastView(visitedViews)\r\n }\r\n })\r\n },\r\n closeLeftTags() {\r\n this.$tab.closeLeftPage(this.selectedTag).then(visitedViews => {\r\n if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {\r\n this.toLastView(visitedViews)\r\n }\r\n })\r\n },\r\n closeOthersTags() {\r\n this.$router.push(this.selectedTag.fullPath).catch(() => {})\r\n this.$tab.closeOtherPage(this.selectedTag).then(() => {\r\n this.moveToCurrentTag()\r\n })\r\n },\r\n closeAllTags(view) {\r\n this.$tab.closeAllPage().then(({ visitedViews }) => {\r\n if (this.affixTags.some(tag => tag.path === this.$route.path)) {\r\n return\r\n }\r\n this.toLastView(visitedViews, view)\r\n })\r\n },\r\n toLastView(visitedViews, view) {\r\n const latestView = visitedViews.slice(-1)[0]\r\n if (latestView) {\r\n this.$router.push(latestView.fullPath)\r\n } else {\r\n if (view && view.name === 'Dashboard') {\r\n this.$router.replace({ path: '/redirect' + view.fullPath })\r\n } else {\r\n this.$router.push('/')\r\n }\r\n }\r\n },\r\n openMenu(tag, e) {\r\n this.left = e.clientX\r\n this.top = e.clientY\r\n this.visible = true\r\n this.selectedTag = tag\r\n },\r\n closeMenu() {\r\n this.visible = false\r\n },\r\n handleScroll() {\r\n this.closeMenu()\r\n this.updateArrowState()\r\n }\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n$tags-bar-height: 34px;\r\n\r\n.tags-view-container {\r\n height: $tags-bar-height;\r\n width: 100%;\r\n background: #fff;\r\n border-bottom: 1px solid #dce6e2;\r\n box-shadow: 0 1px 2px rgba(19, 45, 37, 0.04);\r\n display: flex;\r\n align-items: center;\r\n overflow: hidden;\r\n\r\n $btn-width: 28px;\r\n $btn-color: #71717a;\r\n $btn-hover-bg: #f0f2f5;\r\n $btn-hover-color: #303133;\r\n $btn-disabled-color: #c0c4cc;\r\n $divider: 1px solid #d8dce5;\r\n\r\n .tags-nav-btn {\r\n flex-shrink: 0;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: $btn-width;\r\n height: $tags-bar-height;\r\n cursor: pointer;\r\n color: $btn-color;\r\n font-size: 13px;\r\n user-select: none;\r\n transition: background 0.15s, color 0.15s;\r\n\r\n &:hover:not(.disabled) {\r\n background: $btn-hover-bg;\r\n color: $btn-hover-color;\r\n }\r\n\r\n &.disabled {\r\n color: $btn-disabled-color;\r\n cursor: not-allowed;\r\n }\r\n\r\n &--left { border-right: $divider; }\r\n &--right { border-left: $divider; }\r\n }\r\n\r\n .tags-view-wrapper {\r\n flex: 1;\r\n min-width: 0;\r\n height: 100%;\r\n\r\n .tags-view-item {\r\n display: inline-block;\r\n position: relative;\r\n cursor: pointer;\r\n height: 26px;\r\n line-height: 26px;\r\n border: 1px solid #dce6e2;\r\n color: #52645f;\r\n background: #fff;\r\n padding: 0 8px;\r\n font-size: 12px;\r\n margin-left: 5px;\r\n border-radius: 5px;\r\n transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;\r\n\r\n &:hover {\r\n color: #0b6b55;\r\n background: #f3f8f6;\r\n border-color: #b6cec5;\r\n }\r\n\r\n &:first-of-type { margin-left: 6px; }\r\n &:last-of-type { margin-right: 15px; }\r\n }\r\n }\r\n &:not(.tags-view-container--chrome) .tags-view-wrapper .tags-view-item.active {\r\n background-color: #e8f3ef;\r\n color: #085442;\r\n border-color: #0b6b55;\r\n font-weight: 600;\r\n &::before {\r\n content: '';\r\n background: #c69b3c;\r\n display: inline-block;\r\n width: 3px;\r\n height: 12px;\r\n border-radius: 2px;\r\n position: relative;\r\n margin-right: 2px;\r\n }\r\n }\r\n\r\n &:not(.tags-view-container--chrome) .tags-view-wrapper .tags-view-item.active.has-icon::before {\r\n content: none !important;\r\n }\r\n\r\n .tags-action-dropdown {\r\n flex-shrink: 0;\r\n display: flex;\r\n align-items: center;\r\n }\r\n\r\n .tags-action-btn {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: $btn-width;\r\n height: $tags-bar-height;\r\n cursor: pointer;\r\n color: $btn-color;\r\n font-size: 13px;\r\n border-left: $divider;\r\n user-select: none;\r\n transition: background 0.15s, color 0.15s;\r\n\r\n &:hover {\r\n background: $btn-hover-bg;\r\n color: $btn-hover-color;\r\n }\r\n }\r\n\r\n .tags-refresh-btn {\r\n width: 60px;\r\n }\r\n\r\n .contextmenu {\r\n margin: 0;\r\n background: #fff;\r\n z-index: 3000;\r\n position: fixed;\r\n list-style-type: none;\r\n padding: 5px 0;\r\n border-radius: 4px;\r\n font-size: 12px;\r\n font-weight: 400;\r\n color: #333;\r\n box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);\r\n\r\n li {\r\n margin: 0;\r\n padding: 7px 16px;\r\n cursor: pointer;\r\n &:hover {\r\n background: #eee;\r\n }\r\n }\r\n }\r\n &.tags-view-container--chrome {\r\n --chrome-strip-bg: #ffffff;\r\n --chrome-strip-border: #e4e7ed;\r\n --chrome-tab-text: #606266;\r\n\r\n overflow: visible;\r\n background: var(--chrome-strip-bg);\r\n border-bottom: 1px solid var(--chrome-strip-border);\r\n align-items: flex-end;\r\n\r\n .tags-nav-btn {\r\n align-self: stretch;\r\n height: auto;\r\n min-height: $tags-bar-height;\r\n border-color: var(--chrome-strip-border);\r\n }\r\n\r\n .tags-action-btn {\r\n border-color: var(--chrome-strip-border);\r\n }\r\n\r\n .tags-view-wrapper {\r\n .tags-view-item {\r\n display: inline-flex !important;\r\n align-items: center;\r\n justify-content: center;\r\n position: relative;\r\n z-index: 1;\r\n height: 30px;\r\n min-height: 30px;\r\n margin: 0 0 -1px;\r\n padding: 0 12px;\r\n font-size: 13px;\r\n font-weight: 400;\r\n line-height: 1.2;\r\n border: none !important;\r\n border-radius: 0;\r\n background: transparent !important;\r\n color: var(--chrome-tab-text) !important;\r\n padding-top: 0 !important;\r\n box-shadow: none !important;\r\n transition: background 0.12s ease, color 0.12s ease, border-radius 0.12s ease;\r\n\r\n &::before,\r\n &::after {\r\n content: '' !important;\r\n display: block !important;\r\n position: absolute;\r\n bottom: 0;\r\n width: var(--chrome-wing-r);\r\n height: var(--chrome-wing-r);\r\n margin: 0 !important;\r\n pointer-events: none;\r\n background: transparent !important;\r\n border-radius: 0 !important;\r\n transition: box-shadow 0.12s ease;\r\n }\r\n\r\n &::before {\r\n left: calc(-1 * var(--chrome-wing-r));\r\n border-bottom-right-radius: var(--chrome-wing-r) !important;\r\n box-shadow: none;\r\n }\r\n\r\n &::after {\r\n right: calc(-1 * var(--chrome-wing-r));\r\n border-bottom-left-radius: var(--chrome-wing-r) !important;\r\n box-shadow: none;\r\n }\r\n\r\n &:first-of-type { margin-left: 6px; }\r\n &:last-of-type { margin-right: 10px; }\r\n\r\n &:not(.active) + .tags-view-item:not(.active) {\r\n border-left: 1px solid #e4e7ed;\r\n padding-left: 11px;\r\n }\r\n\r\n &:hover:not(.active) {\r\n background: #f5f7fa !important;\r\n border-radius: 6px 6px 0 0;\r\n color: #303133 !important;\r\n z-index: 2;\r\n }\r\n\r\n &.active {\r\n height: 33px;\r\n min-height: 33px;\r\n padding: 0 14px;\r\n z-index: 3;\r\n color: var(--chrome-tab-text-active) !important;\r\n font-weight: 500;\r\n background: var(--chrome-tab-active-bg) !important;\r\n border: none !important;\r\n border-bottom: 2px solid var(--chrome-tab-active-bg) !important;\r\n border-radius: var(--chrome-wing-r) var(--chrome-wing-r) 0 0;\r\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);\r\n\r\n &::before {\r\n box-shadow: calc(var(--chrome-wing-r) * 0.5) calc(var(--chrome-wing-r) * 0.5) 0 calc(var(--chrome-wing-r) * 0.5) var(--chrome-tab-active-bg);\r\n }\r\n\r\n &::after {\r\n box-shadow: calc(var(--chrome-wing-r) * -0.5) calc(var(--chrome-wing-r) * 0.5) 0 calc(var(--chrome-wing-r) * 0.5) var(--chrome-tab-active-bg);\r\n }\r\n }\r\n .el-icon-close {\r\n margin-left: 3px;\r\n &:before {\r\n vertical-align: -2px;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n</style>\r\n\r\n<style lang=\"scss\">\r\n.tags-view-wrapper {\r\n .el-scrollbar {\r\n height: 100%;\r\n overflow: hidden;\r\n }\r\n\r\n .el-scrollbar__wrap {\r\n height: 34px !important;\r\n display: flex;\r\n align-items: center;\r\n overflow-x: auto;\r\n overflow-y: hidden;\r\n \r\n &::-webkit-scrollbar {\r\n width: 0;\r\n height: 0;\r\n }\r\n \r\n .tags-view-container:hover & {\r\n &::-webkit-scrollbar {\r\n width: 6px;\r\n height: 6px;\r\n }\r\n \r\n &::-webkit-scrollbar-track {\r\n background: transparent;\r\n }\r\n \r\n &::-webkit-scrollbar-thumb {\r\n background-color: rgba(0, 0, 0, 0.2);\r\n border-radius: 3px;\r\n transition: background-color 0.2s;\r\n \r\n &:hover {\r\n background-color: rgba(0, 0, 0, 0.4);\r\n }\r\n }\r\n }\r\n \r\n scrollbar-width: none;\r\n -ms-overflow-style: none;\r\n }\r\n\r\n .el-scrollbar__bar {\r\n opacity: 0;\r\n transition: opacity 0.3s;\r\n z-index: 10;\r\n\r\n .tags-view-container:hover & {\r\n opacity: 1;\r\n }\r\n }\r\n\r\n .tags-view-container--chrome & {\r\n .el-scrollbar {\r\n position: relative;\r\n }\r\n\r\n .el-scrollbar__wrap {\r\n &::-webkit-scrollbar {\r\n width: 0 !important;\r\n height: 0 !important;\r\n }\r\n scrollbar-width: none;\r\n -ms-overflow-style: none;\r\n }\r\n\r\n .el-scrollbar__bar.is-horizontal {\r\n z-index: 20;\r\n height: 6px !important;\r\n }\r\n }\r\n\r\n .tags-view-item {\r\n .el-icon-close {\r\n width: 16px;\r\n height: 16px;\r\n vertical-align: 2px;\r\n border-radius: 50%;\r\n text-align: center;\r\n transition: all .3s cubic-bezier(.645, .045, .355, 1);\r\n transform-origin: 100% 50%;\r\n &:before {\r\n transform: scale(.6);\r\n display: inline-block;\r\n vertical-align: -3px;\r\n }\r\n &:hover {\r\n background-color: #b4bccc;\r\n color: #fff;\r\n }\r\n }\r\n }\r\n}\r\n\r\n/* 页签全屏模式样式 */\r\n.main-container.fullscreen-mode {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100vw;\r\n height: 100vh;\r\n overflow: hidden;\r\n margin-left: 0 !important;\r\n transition: none !important;\r\n}\r\n\r\n.main-container.fullscreen-mode .fixed-header {\r\n display: block !important;\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n width: 100% !important;\r\n z-index: 1000;\r\n transition: none !important;\r\n}\r\n\r\n.main-container.fullscreen-mode .fixed-header .navbar {\r\n display: none !important;\r\n}\r\n\r\n.main-container.fullscreen-mode .app-main {\r\n position: fixed;\r\n top: 34px;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n margin: 0 !important;\r\n padding: 0 !important;\r\n height: calc(100vh - 34px) !important;\r\n min-height: calc(100vh - 34px) !important;\r\n overflow: auto;\r\n}\r\n</style>\r\n"]}]} |