diff --git a/locales/en.yaml b/locales/en.yaml index 37b95a940..d02f36f93 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -53,6 +53,8 @@ panel: pureTagsStyleSmartTip: Smart tags add fun and brilliance pureTagsStyleCard: Card pureTagsStyleCardTip: Card tags for efficient browsing + pureTagsStyleChrome: Chrome + pureTagsStyleChromeTip: Chrome style is classic and elegant pureInterfaceDisplay: Interface Display pureGreyModel: Grey Model pureWeakModel: Weak Model diff --git a/locales/zh-CN.yaml b/locales/zh-CN.yaml index 0412b0ff8..6ce420969 100644 --- a/locales/zh-CN.yaml +++ b/locales/zh-CN.yaml @@ -53,6 +53,8 @@ panel: pureTagsStyleSmartTip: 灵动标签,添趣生辉 pureTagsStyleCard: 卡片 pureTagsStyleCardTip: 卡片标签,高效浏览 + pureTagsStyleChrome: 谷歌 + pureTagsStyleChromeTip: 谷歌风格,经典美观 pureInterfaceDisplay: 界面显示 pureGreyModel: 灰色模式 pureWeakModel: 色弱模式 diff --git a/src/layout/components/lay-content/index.vue b/src/layout/components/lay-content/index.vue index 56bdd136c..5810d665b 100644 --- a/src/layout/components/lay-content/index.vue +++ b/src/layout/components/lay-content/index.vue @@ -2,6 +2,7 @@ import { useI18n } from "vue-i18n"; import LayFrame from "../lay-frame/index.vue"; import LayFooter from "../lay-footer/index.vue"; +import { useTags } from "@/layout/hooks/useTag"; import { useGlobal, isNumber } from "@pureadmin/utils"; import BackTopIcon from "@/assets/svg/back_top.svg?component"; import { h, computed, Transition, defineComponent } from "vue"; @@ -12,6 +13,7 @@ const props = defineProps({ }); const { t } = useI18n(); +const { showModel } = useTags(); const { $storage, $config } = useGlobal(); const isKeepAlive = computed(() => { @@ -51,9 +53,17 @@ const getMainWidth = computed(() => { const getSectionStyle = computed(() => { return [ hideTabs.value && layout ? "padding-top: 48px;" : "", - !hideTabs.value && layout ? "padding-top: 81px;" : "", + !hideTabs.value && layout + ? showModel.value == "chrome" + ? "padding-top: 85px;" + : "padding-top: 81px;" + : "", hideTabs.value && !layout.value ? "padding-top: 48px;" : "", - !hideTabs.value && !layout.value ? "padding-top: 81px;" : "", + !hideTabs.value && !layout.value + ? showModel.value == "chrome" + ? "padding-top: 85px;" + : "padding-top: 81px;" + : "", props.fixedHeader ? "" : `padding-top: 0;${ diff --git a/src/layout/components/lay-setting/index.vue b/src/layout/components/lay-setting/index.vue index b4c8b7fa0..18aacf256 100644 --- a/src/layout/components/lay-setting/index.vue +++ b/src/layout/components/lay-setting/index.vue @@ -232,6 +232,11 @@ const markOptions = computed>(() => { label: t("panel.pureTagsStyleCard"), tip: t("panel.pureTagsStyleCardTip"), value: "card" + }, + { + label: t("panel.pureTagsStyleChrome"), + tip: t("panel.pureTagsStyleChromeTip"), + value: "chrome" } ]; }); @@ -442,7 +447,7 @@ onUnmounted(() => removeMatchMedia); diff --git a/src/layout/components/lay-tag/components/TagChrome.vue b/src/layout/components/lay-tag/components/TagChrome.vue new file mode 100644 index 000000000..137365b46 --- /dev/null +++ b/src/layout/components/lay-tag/components/TagChrome.vue @@ -0,0 +1,33 @@ + diff --git a/src/layout/components/lay-tag/index.scss b/src/layout/components/lay-tag/index.scss index cc122dd2e..b88121690 100644 --- a/src/layout/components/lay-tag/index.scss +++ b/src/layout/components/lay-tag/index.scss @@ -41,6 +41,13 @@ padding-right: 24px; } + &.chrome-item { + padding-right: 0; + padding-left: 0; + margin-right: -18px; + box-shadow: none; + } + .el-icon-close { position: absolute; top: 50%; @@ -76,6 +83,14 @@ overflow: hidden; white-space: nowrap; + &.chrome-scroll-container { + padding-top: 4px; + + .fixed-tag { + padding: 0 !important; + } + } + .tab { position: relative; float: left; @@ -89,6 +104,12 @@ &:nth-child(1) { padding: 0 12px; } + + &.chrome-item { + &:nth-child(1) { + padding: 0; + } + } } .fixed-tag { @@ -173,9 +194,29 @@ color: #fff; box-shadow: 0 0 0.7px #888; + .chrome-tab { + z-index: 10; + } + + .chrome-tab__bg { + color: var(--el-color-primary-light-9) !important; + } + .tag-title { color: var(--el-color-primary) !important; } + + .chrome-close-btn { + color: var(--el-color-primary); + + &:hover { + background-color: var(--el-color-primary); + } + } + + .chrome-tab-divider { + opacity: 0; + } } .arrow-left, @@ -262,3 +303,69 @@ background: var(--el-color-primary); animation: schedule-out-width 200ms ease-in; } + +/* 谷歌风格的页签 */ +.chrome-tab { + position: relative; + display: inline-flex; + gap: 16px; + align-items: center; + justify-content: center; + padding: 0 24px; + white-space: nowrap; + cursor: pointer; + + .tag-title { + padding: 0; + } + + .chrome-tab-divider { + position: absolute; + right: 7px; + width: 1px; + height: 14px; + background-color: #2b2d2f; + } + + &:hover { + z-index: 10; + + .chrome-tab__bg { + color: #dee1e6; + } + + .tag-title { + color: #1f1f1f; + } + + .chrome-tab-divider { + opacity: 0; + } + } + + .chrome-tab__bg { + position: absolute; + top: 0; + left: 0; + z-index: -10; + width: 100%; + height: 100%; + color: transparent; + pointer-events: none; + } + + .chrome-close-btn { + display: inline-flex; + align-items: center; + justify-content: center; + width: 16px; + height: 16px; + color: #666; + border-radius: 50%; + + &:hover { + color: white; + background-color: #b1b3b8; + } + } +} diff --git a/src/layout/components/lay-tag/index.vue b/src/layout/components/lay-tag/index.vue index fa74ee935..373ceea44 100644 --- a/src/layout/components/lay-tag/index.vue +++ b/src/layout/components/lay-tag/index.vue @@ -5,6 +5,7 @@ import { RouteConfigs } from "../../types"; import { useTags } from "../../hooks/useTag"; import { routerArrays } from "@/layout/types"; import { onClickOutside } from "@vueuse/core"; +import TagChrome from "./components/TagChrome.vue"; import { handleAliveRoute, getTopMenu } from "@/router/utils"; import { useSettingStoreHook } from "@/store/modules/settings"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; @@ -565,6 +566,7 @@ onBeforeUnmount(() => {
@@ -575,6 +577,7 @@ onBeforeUnmount(() => { :class="[ 'scroll-item is-closable', linkIsActive(item), + showModel === 'chrome' && 'chrome-item', !isAllEmpty(item?.meta?.fixedTag) && 'fixed-tag' ]" @contextmenu.prevent="openMenu(item, $event)" @@ -582,28 +585,46 @@ onBeforeUnmount(() => { @mouseleave.prevent="onMouseleave(index)" @click="tagOnClick(item)" > - - {{ transformI18n(item.meta.title) }} - - - - - + +
+
+ +
+ + {{ transformI18n(item.meta.title) }} + + + + + +
diff --git a/src/style/dark.scss b/src/style/dark.scss index 7c3cb65cb..74fe07474 100644 --- a/src/style/dark.scss +++ b/src/style/dark.scss @@ -115,6 +115,22 @@ html.dark { background-color: rgb(255 255 255 / 12%); } } + + .chrome-tab { + .tag-title { + color: #666; + } + + &:hover { + .chrome-tab__bg { + color: #333; + } + + .tag-title { + color: #adadad; + } + } + } } }