vue?頂部消息橫向滾動通知效果實現(xiàn)
更新時間:2024年02月29日 15:15:28 作者:努力學(xué)習(xí)的木子
系統(tǒng)頂部展示一個橫向滾動的消息通知,就是消息內(nèi)容從右往左一直滾動,這篇文章主要介紹了vue頂部消息橫向滾動通知,需要的朋友可以參考下
前言
系統(tǒng)頂部展示一個橫向滾動的消息通知,就是消息內(nèi)容從右往左一直滾動。
效果如下:

代碼
使用
<template>
<div class="notic-bar">
<img :src="notic" class="notice-img" />
<div class="notice-bar-container">
<div class="notice-bar__wrap">
<div
v-for="(item, index) in list"
:key="index"
class="notice-bar__wrap_text"
>
{{ item }}
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import notic from "../../public/notic.png";
const list = [
"開發(fā)不易,感謝理解",
"",
"感謝您的理解",
"",
"您的支持是我繼續(xù)完善的動力",
];
</script>
<style lang="scss" scoped>
.notic-bar {
display: flex;
background: #67c23a;
margin: 5px;
border-radius: 5px;
padding: 2px 5px;
}
.notice-bar-container {
display: flex;
width: calc(100% - 30px);
height: 20px;
overflow: hidden;
margin-left: 5px;
}
.notice-img {
width: 20px;
height: 20px;
}
.notice-bar__wrap {
margin-left: 10px;
display: flex;
animation: move 20s linear infinite;
line-height: 20px;
color: #f5f6f7;
.notice-bar__wrap_text {
width: max-content;
min-width: 100px;
}
}
@keyframes move {
0% {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
}
</style>到此這篇關(guān)于vue 頂部消息橫向滾動通知效果實現(xiàn)的文章就介紹到這了,更多相關(guān)vue 消息橫向滾動內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue-resource調(diào)用promise取數(shù)據(jù)方式詳解
這篇文章主要介紹了vue-resource調(diào)用promise取數(shù)據(jù)方式詳解,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-07-07
vue3+echarts實現(xiàn)好看的圓角環(huán)形圖
這篇文章主要介紹了vue3+echarts實現(xiàn)好看的圓角環(huán)形圖效果,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-10-10
vue 里面的 $forceUpdate() 強制實例重新渲染操作
這篇文章主要介紹了vue 里面的 $forceUpdate() 強制實例重新渲染操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-09-09
Vue.js結(jié)合Ueditor富文本編輯器的實例代碼
本篇文章主要介紹了Vue.js結(jié)合Ueditor的項目實例代碼,這里整理了詳細的代碼,具有一定的參考價值,有興趣的可以了解一下2017-07-07

