style: 系统名称超出范围进行滚动
This commit is contained in:
@@ -10,7 +10,14 @@ import RightContent from './components/RightContent.vue';
|
||||
import Tabs from './components/Tabs.vue';
|
||||
import GlobalMask from '@/components/GlobalMask/index.vue';
|
||||
import { scriptUrl } from '@/assets/js/icon_font_8d5l8fzk5b87iudi';
|
||||
import { computed, reactive, watch, onMounted, onUnmounted } from 'vue';
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
watch,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
nextTick,
|
||||
} from 'vue';
|
||||
import useLayoutStore from '@/store/modules/layout';
|
||||
import useRouterStore from '@/store/modules/router';
|
||||
import useTabsStore from '@/store/modules/tabs';
|
||||
@@ -161,8 +168,27 @@ function fnLocale(m: MenuDataItem) {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**检查系统名称是否超出范围进行滚动 */
|
||||
function fnCheckAppNameOverflow() {
|
||||
const container: HTMLDivElement | null = document.querySelector('.app-name');
|
||||
if (!container) return;
|
||||
const text: HTMLDivElement | null = container.querySelector('.marquee');
|
||||
if (!text) return;
|
||||
if (text.offsetWidth > container.offsetWidth) {
|
||||
text.classList.add('app-name_scrollable');
|
||||
} else {
|
||||
text.classList.remove('app-name_scrollable');
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => appStore.appName,
|
||||
() => nextTick(fnCheckAppNameOverflow)
|
||||
);
|
||||
|
||||
//
|
||||
onMounted(() => {
|
||||
fnCheckAppNameOverflow();
|
||||
fnGetServerTime();
|
||||
useAlarmStore().fnGetActiveAlarmInfo();
|
||||
});
|
||||
@@ -246,8 +272,10 @@ onUnmounted(() => {
|
||||
:alt="appStore.appName"
|
||||
:title="appStore.appName"
|
||||
/>
|
||||
<h1 class="title" :title="appStore.appName">
|
||||
{{ appStore.appName }}
|
||||
<h1 class="app-name" :title="appStore.appName">
|
||||
<span class="marquee app-name_scrollable">
|
||||
{{ appStore.appName }}
|
||||
</span>
|
||||
</h1>
|
||||
</template>
|
||||
<template v-if="appStore.logoType === 'brand'">
|
||||
@@ -349,11 +377,27 @@ onUnmounted(() => {
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.title {
|
||||
.app-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
// text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 130px;
|
||||
width: 148px;
|
||||
|
||||
&_scrollable {
|
||||
// padding-left: 100%;
|
||||
display: inline-block;
|
||||
animation: scrollable-animation linear 6s infinite both;
|
||||
}
|
||||
|
||||
@keyframes scrollable-animation {
|
||||
0% {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate3d(-100%, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
|
||||
Reference in New Issue
Block a user