Element-plus使用中遇到的问题小结
脚本之家 / 编程助手:解决程序员“几乎”所有问题!
脚本之家官方知识库 → 点击立即使用
el-input
设置type='number',会出现上下箭头,在全局配置css样式即可解决,在app.vue中的css中加入:
1 2 3 4 5 6 7 8 9 10 11 12 | .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条数据,以后新增订阅获取一条,新增一条则向上滑动显示最新数据。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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
到此这篇关于Element-plus使用中遇到的问题的文章就介绍到这了,更多相关Element-plus使用内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

微信公众号搜索 “ 脚本之家 ” ,选择关注
程序猿的那些事、送书等活动等着你
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权/违法违规/事实不符,请将相关资料发送至 reterry123@163.com 进行投诉反馈,一经查实,立即处理!
最新评论