1. npm 下载依赖
npm install vue-seamless-scroll --save
2.在需要使用的页面引入
import vueSeamlessScroll from 'vue-seamless-scroll' components: { vueSeamlessScroll },
3.完整代码
<template> <div> <vue-seamless-scroll :data="dataArr.eventData" class="seamless-warp" :class-option="classOption" @ScrollEnd="scrollEnd" ref="seamlessScroll" > <!-- 需实现滚动代码 --> </vue-seamless-scroll> </div> </template> <script> import vueSeamlessScroll from "vue-seamless-scroll"; export default { name: "RightModulesThree", components: { vueSeamlessScroll }, data() { return {}; }, computed: { classOption() { return { step: 0.3, // 数值越大速度滚动越快 limitMoveNum:9, // 开始无缝滚动的数据量 this.dataList.length hoverStop: true, // 是否开启鼠标悬停stop direction: 1, // 0向下 1向上 2向左 3向右 openWatch: true, // 开启数据实时监控刷新dom singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1 singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3 waitTime: 1000, // 单步运动停止的时间(默认值1000ms) }; }, }, methods: { setDian(i,e){ let data = e.target.dataset; this.$emit("supervise-detail", data.name, data.type); this.$refs.seamlessScroll.reset(); // 表示重置意思 let target = e.target; if(target.tagName == "SPAN") { console.log(i,'789456') console.log(e,'1111') } }, }, }; </script>
<style scoped lang="scss"> .box_right_3 { flex: 1; overflow: hidden; background-size: 100% 100%; font-family: Alibaba-PuHuiTi-R; font-size: 14px; color: #ade2ff; letter-spacing: 0; } .seamless-warp { width: 100%; margin: 8px 0px; color: white; overflow: hidden; .warp-item { display: flex; justify-content: space-between; font-size: 14px; color: #FFFFFF; align-items: center; height: 48px; .item_con { background-size: 100% 100%; padding: 2px 0px; color: #04d6de; } } } .warp-item-one{ display: flex; justify-content: space-between; font-size: 14px; color: #FFFFFF; align-items: center; height: 48px; } .gd_title{ display: flex; justify-content: space-between; align-items: center; color: #76CCF4 ; font-size: 14px; margin-top: 22px; height: 36px; background: linear-gradient(207deg, rgba(96,157,215,0.1) 0%, rgba(129,189,250,0.6) 100%); } .shenpi{ background-size: 100% 100%; color:#FF5000 ; } </style>
原文地址:http://www.cnblogs.com/zsc1996/p/16852385.html
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,请务用于商业用途!
3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员!
8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载
声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性