vue 顶部消息横向滚动通知效果实现
更新时间:2024年02月29日 15:15:28 作者:努力学习的木子
系统顶部展示一个横向滚动的消息通知,就是消息内容从右往左一直滚动,这篇文章主要介绍了vue顶部消息横向滚动通知,需要的朋友可以参考下
前言
系统顶部展示一个横向滚动的消息通知,就是消息内容从右往左一直滚动。
效果如下:

代码
使用
<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 = [
"开发不易,感谢理解",
"",
"感谢您的理解",
"",
"您的支持是我继续完善的动力",
];
</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>到此这篇关于vue 顶部消息横向滚动通知效果实现的文章就介绍到这了,更多相关vue 消息横向滚动内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
vue+Ant Design进度条滑块与input联动效果实现
最近接到这样一个需求滑块进度与输入框为一致,默认值为80,最小不能小于30,最大为100,怎么实现这个联动效果呢,下面小编给大家分享下基于vue+Ant Design进度条滑块与input联动效果的实现,感兴趣的朋友跟随小编一起看看吧2022-12-12
Vue 3中的defineEmits()和defineProps()使用小结
defineProps()和defineEmits()是Vue 3中Composition API的重要组成部分,它们分别用于定义组件接收的属性和触发的事件,本文给大家介绍Vue 3中的defineEmits()和defineProps()解析,感兴趣的朋友跟随小编一起看看吧2024-04-04
Element-UI日期选择器(选择日期范围)禁用未来日期实现代码
我们在网页开发时通常需要用到一些日期组件来方便用户选择时间,其中element日期组件是一个非常好用的工具,这篇文章主要给大家介绍了关于Element-UI日期选择器(选择日期范围)禁用未来日期的相关资料,需要的朋友可以参考下2024-02-02


最新评论