• vue实现列表自动滚动效果


    效果如图:

    1.下载插件

    npm install vue-seamless-scroll --save

     2.在main.js中引入注册

    1. import scroll from 'vue-seamless-scroll'
    2. Vue.use(scroll)

    3.在页面中使用(写一个固定的表头 el-table:show-header="status" 设置为false,自带的表头不显示)

    1. <div class="table-box">
    2. //静态表头
    3. <div class="toptitle">
    4. <div class="item">序号div>
    5. <div class="item">检测点div>
    6. <div class="item">时间div>
    7. <div class="item">识别项div>
    8. <div class="item">结果div>
    9. div>
    10. //滚动组件
    11. <vue-seamless-scroll :data="tableData" :class-option="optionHover" class="seamless-warp">
    12. <el-table :data="tableData" @row-click="showRowDetail" style="width: 100%" :show-header="status"
    13. :row-class-name="tableRowClassName">
    14. <el-table-column type="index" label="序号" width="50">
    15. el-table-column>
    16. <el-table-column prop="siteName" label="检测点">
    17. <template slot-scope="scope">
    18. <span>{{ scope.row.siteName ? scope.row.siteName : '---' }}span>
    19. template>
    20. el-table-column>
    21. <el-table-column prop="ts" label="时间">
    22. <template slot-scope="scope">
    23. <span>{{ scope.row.ts ? scope.row.ts : '---' }}span>
    24. template>
    25. el-table-column>
    26. <el-table-column prop="fun" label="识别项">
    27. <template slot-scope="scope">
    28. <span>{{ scope.row.fun == "valve" ? '炉门' : scope.row.fun == "rod" ? '摆臂' : '---' }}span>
    29. template>
    30. el-table-column>
    31. <el-table-column prop="err" label="结果">
    32. <template slot-scope="scope">
    33. <span>{{ scope.row.err === 0 ? '正常' : scope.row.err === 1 ? '异常' : '---' }}span>
    34. template>
    35. el-table-column>
    36. el-table>
    37. vue-seamless-scroll>
    38. div>

    4.js配置滚动插件配置对象

    1. computed: {
    2. optionHover() {
    3. return {
    4. step: 1, // 数值越大速度滚动越快
    5. limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length
    6. hoverStop: true, // 是否开启鼠标悬停stop
    7. direction: 1, // 0向下 1向上 2向左 3向右
    8. openWatch: true, // 开启数据实时监控刷新dom
    9. singleHeight: 20, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
    10. singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
    11. waitTime: 1000, // 单步运动停止的时间(默认值1000ms)
    12. };
    13. },
    14. }

    3.效果图样式

  • 相关阅读:
    一部分热点识别的技术方案记录
    C# - 常用API
    uni-app集成mui-player
    腾讯云自定义配置购买云服务器图文操作教程 新手必看!
    Java框架(四)--Spring AOP面向切面编程(2)--五种通知类型及利用注解配置Spring AOP
    FastAPI获年度第一新兴框架,2021年最受欢迎的TOP 100开发工具出炉
    抗肿瘤靶向药物丨小分子化合物 or 单克隆抗体?- MedChemExpress
    网易数帆陈谔:低代码平台,应对企业应用开发复杂性的一剂良方
    MyBatis注解开发实现学生管理页面(分页pagehelper,多条件搜索,查看课程信息)
    # 如何在Windows下运行Linux程序
  • 原文地址:https://blog.csdn.net/killerdoubie/article/details/132664845