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

相关推荐
wzl202612138 分钟前
企业微信定时群发技术实现与实操指南(原生接口+工具落地)
java·运维·前端·企业微信
小码哥_常10 分钟前
Robots.txt:互联网爬虫世界的“隐形规则”
前端
小码哥_常22 分钟前
Android开发神器:AndroidAutoSize,轻松搞定屏幕适配
前端
前端一小卒24 分钟前
前端工程师的全栈焦虑,我用 60 天治好了
前端·javascript·后端
不停喝水29 分钟前
【AI+Cursor】 告别切图仔,拥抱Vibe Coding: AI + Cursor 开启多模态全栈新纪元 (1)
前端·人工智能·后端·ai·ai编程·cursor
coderyi2 小时前
LLM Agent 浅析
前端·javascript·人工智能
科雷软件测试2 小时前
使用python+Midscene.js AI驱动打造企业级WEB自动化解决方案
前端·javascript·python
ConardLi2 小时前
把 Claude Design 做成 Skill,你的网站也能拥有顶级视觉体验
前端·人工智能·后端
We་ct2 小时前
LeetCode 120. 三角形最小路径和:动态规划详解
前端·javascript·算法·leetcode·typescript·动态规划