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