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

相关推荐
luoluoal5 分钟前
java项目之基于Spring Boot智能无人仓库管理源码(springboot+vue)
java·vue.js·spring boot
吕彬-前端12 分钟前
使用vite+react+ts+Ant Design开发后台管理项目(二)
前端·react.js·前端框架
小白小白从不日白33 分钟前
react hooks--useCallback
前端·react.js·前端框架
恩婧41 分钟前
React项目中使用发布订阅模式
前端·react.js·前端框架·发布订阅模式
mez_Blog42 分钟前
个人小结(2.0)
前端·javascript·vue.js·学习·typescript
珊珊而川1 小时前
【浏览器面试真题】sessionStorage和localStorage
前端·javascript·面试
森叶1 小时前
Electron 安装包 asar 解压定位问题实战
前端·javascript·electron
drebander1 小时前
ubuntu 安装 chrome 及 版本匹配的 chromedriver
前端·chrome
软件技术NINI1 小时前
html知识点框架
前端·html
深情废杨杨1 小时前
前端vue-插值表达式和v-html的区别
前端·javascript·vue.js