In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
这篇文章主要讲解了"vue怎么实现消息向上无缝滚动效果",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"vue怎么实现消息向上无缝滚动效果"吧!
效果如下
代码:
... export default { data() { return { noticeList: [], animate:false, intNum: undefined, } }, created: function () { this.getNoticeData(); }, methods: { getNoticeData() { this.$http.get('/news/allList', { params: { 'pageNumber': 10, 'currentPage': 1 } }).then(res => { this.noticeList = res.data.items; this.ScrollUp(); }); }, ScrollUp() { this.intNum = setInterval(() => { this.animate=true;// 向上滚动的时候需要添加css3过渡动画 setTimeout(()=>{ this.noticeList.push(this.noticeList[0]);// 将数组的第一个元素添加到数组的 this.noticeList.shift(); //删除数组的第一个元素 this.animate=false; },500) }, 10000); }, //鼠标移上去停止 Stop() { clearInterval(this.intNum); }, Up() { this.ScrollUp(); }, } }
样式
.new-list{ line-height: 28px; transition: top 0.5s;}.anim{ transition: all 0.5s; margin-top: -28px;//高度等于行高}感谢各位的阅读,以上就是"vue怎么实现消息向上无缝滚动效果"的内容了,经过本文的学习后,相信大家对vue怎么实现消息向上无缝滚动效果这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.