fix: 系统名称横向滚动衔接动画
This commit is contained in:
@@ -176,6 +176,7 @@ function fnCheckAppNameOverflow() {
|
||||
if (!text) return;
|
||||
if (text.offsetWidth > container.offsetWidth) {
|
||||
text.classList.add('app-name_scrollable');
|
||||
text.setAttribute('data-content', text.innerText);
|
||||
} else {
|
||||
text.classList.remove('app-name_scrollable');
|
||||
}
|
||||
@@ -382,20 +383,26 @@ onUnmounted(() => {
|
||||
// text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 148px;
|
||||
|
||||
&_scrollable {
|
||||
// padding-left: 100%;
|
||||
> .app-name_scrollable {
|
||||
padding-right: 12px;
|
||||
display: inline-block;
|
||||
animation: scrollable-animation linear 6s infinite both;
|
||||
}
|
||||
|
||||
@keyframes scrollable-animation {
|
||||
0% {
|
||||
transform: translate3d(0, 0, 0);
|
||||
&::after {
|
||||
content: attr(data-content);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -100%;
|
||||
transition: right 0.3s ease;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate3d(-100%, 0, 0);
|
||||
@keyframes scrollable-animation {
|
||||
0% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateX(calc(-100% - 12px));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +206,7 @@ function fnCheckAppNameOverflow() {
|
||||
if (!text) return;
|
||||
if (text.offsetWidth > container.offsetWidth) {
|
||||
text.classList.add('app-name_scrollable');
|
||||
text.setAttribute('data-content', text.innerText);
|
||||
} else {
|
||||
text.classList.remove('app-name_scrollable');
|
||||
}
|
||||
@@ -398,18 +399,25 @@ onMounted(() => {
|
||||
font-size: 18px;
|
||||
|
||||
> .app-name_scrollable {
|
||||
// padding-left: 100%;
|
||||
padding-right: 12px;
|
||||
display: inline-block;
|
||||
animation: scrollable-animation linear 6s infinite both;
|
||||
}
|
||||
|
||||
@keyframes scrollable-animation {
|
||||
0% {
|
||||
transform: translate3d(0, 0, 0);
|
||||
&::after {
|
||||
content: attr(data-content);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -100%;
|
||||
transition: right 0.3s ease;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate3d(-100%, 0, 0);
|
||||
@keyframes scrollable-animation {
|
||||
0% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateX(calc(-100% - 12px));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,12 +184,15 @@ watch(
|
||||
|
||||
/**检查系统名称是否超出范围进行滚动 */
|
||||
function fnCheckAppNameOverflow() {
|
||||
const container: HTMLDivElement | null = document.querySelector('.header-icon > .app-name');
|
||||
const container: HTMLDivElement | null = document.querySelector(
|
||||
'.header-icon > .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');
|
||||
text.setAttribute('data-content', text.innerText);
|
||||
} else {
|
||||
text.classList.remove('app-name_scrollable');
|
||||
}
|
||||
@@ -201,7 +204,7 @@ watch(
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
fnCheckAppNameOverflow()
|
||||
fnCheckAppNameOverflow();
|
||||
Object.assign(state, {
|
||||
language: currentLocale.value,
|
||||
filePath: '',
|
||||
@@ -360,20 +363,27 @@ onMounted(() => {
|
||||
margin: 0 0 0 12px;
|
||||
font-weight: 600;
|
||||
font-size: 18px;
|
||||
|
||||
|
||||
> .app-name_scrollable {
|
||||
// padding-left: 100%;
|
||||
padding-right: 12px;
|
||||
display: inline-block;
|
||||
animation: scrollable-animation linear 6s infinite both;
|
||||
}
|
||||
|
||||
@keyframes scrollable-animation {
|
||||
0% {
|
||||
transform: translate3d(0, 0, 0);
|
||||
&::after {
|
||||
content: attr(data-content);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -100%;
|
||||
transition: right 0.3s ease;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate3d(-100%, 0, 0);
|
||||
@keyframes scrollable-animation {
|
||||
0% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateX(calc(-100% - 12px));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user