vuejs如何实现文字上下滚动效果,下面web建站小编给大家详细介绍一下实现代码!
实现代码如下:
<div class="scroll">
<ul ref="rollul" :class="{anim:animate==true}">
<li v-for="item in lists">
<span>{{item.time}}</span>
<span>{{randomPhoneNumber()}}</span>
<span>{{item.company}}</span>
</li>
</ul>
</div>
<script>
new Vue({
el:'#app',
data(){
return{
animate:false,
lists:[
{time:'2秒钟前',company:'公司1'},
{time:'8秒钟前',company:'公司2'},
{time:'3分钟前',company:'公司3'},
{time:'5分钟前',company:'公司4'}
],
};
},
created(){
setInterval(this.scroll,2000)
},
methods:{
// 根据字典生成随机序列
randomCode:function (len,dict) {
for (var i = 0,rs = ''; i < len; i++)
rs += dict.charAt(Math.floor(Math.random() * 100000000) % dict.length);
return rs;
},
// 生成随机手机号码
randomPhoneNumber:function(){
return [1,this.$options.methods.randomCode(2,'3458'),'****',this.$options.methods.randomCode(4,'0123456789')].join('');
},
scroll(){
this.animate = true
var that = this;
setTimeout(function(){
that.lists.push(that.lists[0]);
that.lists.shift();
that.animate=false;
},1500)
}
}
})
</script>
上面是“vuejs如何实现文字上下滚动效果”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_3053.html
workflows工作流
一颗闪闪发光的水晶漂浮在森林里
在森林中心有一座蛇形的房子ComfyUI工作流
一位身穿金色铠甲的美丽女子守卫在寺庙外
王家卫电视剧繁花海报效果comfyui工作流
一朵染血的白玫瑰ComfyUI工作流
星空星域星球comfyui工作流
嘴唇丰满的漂亮女人
一只张大嘴巴露出锋利的牙齿正在咆哮的雪豹
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

js+css3做一个灯泡开灯关灯效果
iframe开发admin后台
3D彩色卡片
SVG路径动画效果
数字滚动效果(兼容IE6/IE8)
利用js做一个炫酷音乐背景效果
jquery做一个漂亮挂墙动态时钟
制作一个好玩的倒计时







