Element-plus使用中遇到的问题

el-input

复制代码
设置type='number',会出现上下箭头,在全局配置css样式即可解决,在app.vue中的css中加入:
javascript 复制代码
.table-clear-row {
  input::-webkit-outer-spin-button,
  input::-webkit-inner-spin-button {
    -webkit-appearance: none;
  }

  input[type="number"] {
    -moz-appearance: textfield;
  }

  inpit {
    border: none;
  }
}

.table-clear-row为el-input所在的div类名

el-table实现滚动效果

表格数据是websocket通信获取的数据,首次获取20条数据,以后新增订阅获取一条,新增一条则向上滑动显示最新数据。

javascript 复制代码
const scroll = (tableBody: any) => {
  // 先清除后设置
  cancelAnimationFrame(scrollTimer.value);
  let isScroll = true; //滚动
  const tableDom = tableBody.getElementsByClassName("el-scrollbar__wrap")[0];
  tableDom.scrollTop = tableDom.scrollHeight - curScrollHeight.value - tableDom.clientHeight;
  tableData.value.length <= 300 && (curScrollHeight.value += tableDom.scrollTop);
  scrollTimer.value = requestAnimationFrame(function fn() {
    if (isScroll) {
      tableDom.scrollTop -= 2; //设置滚动速度
      if (tableDom.scrollTop <= 0) {
        isScroll = false;
        if (tableData.value.length > 300) {
          tableData.value.pop();
        }
      }
    }
    requestAnimationFrame(fn);
  })

方法中的tableBody参数为table的ref,tableRef.value.$refs.bodyWrapper

相关推荐
光影少年23 分钟前
react批量更新、同步/异步更新场景
前端·react.js·掘金·金石计划
假如让我当三天老蒯29 分钟前
模块化:ES Module 与 CommonJS 的区别
前端·面试
用户409501157731731 分钟前
Private Forge v2.0 发布:12大前端业务场景技能系统
前端
weedsfly1 小时前
异步编程全景与事件循环——彻底搞懂 JS 执行机制
前端·javascript
用户059540174461 小时前
AI Agent记忆测试踩坑实录:Mock骗了我一周,Mem0+pytest一招破局
前端·css
用户1733598075371 小时前
纯前端 PDF 数字签名实战:Vue 3 + pdf-lib 在浏览器里完成签名嵌入
前端·javascript
IT_陈寒2 小时前
SpringBoot自动配置的坑,我爬了三天才出来
前端·人工智能·后端
Avan_菜菜9 小时前
AI 能写代码了,为什么我反而开始要求它先写文档?
前端·github·ai编程
爱勇宝13 小时前
鸿蒙生态的下半场:开发者不只要能开发,还要能赚钱
android·前端·程序员
IT_陈寒16 小时前
SpringBoot这个自动配置坑我跳了三次
前端·人工智能·后端