当前位置: 首页 > news >正文

dev类似于excel的数据编辑

 其实这个不是我最后的结果,只是中间demo,因为我的场景数据量很大,2w左右,有数据合并,我更倾向于el-table是实现,但不想el-input一直显示,想用if-else 去做隐藏,但是用type=textarea发现高度适配有点问题,其中做了两种实验:
(1)失去焦点和获取焦点获取容器的高度再赋值给 textarea
(2)textarea点位设置  position: absolute设置显示和隐藏样式,但是同样发现需要很多歌el-input做显示隐藏 ,但是我不想这么处理。
(3)用dev去实现el-table,用flex 或grid 布局去实现
以下为dev用flex去实现的方法

<template><div class="page"><div class="table table-input-box"><divstyle="flex: 1"v-for="(item, index) in tableData":key="index"class="textarea-item"><div class="textarea-row"><divstyle="flex: 1"@click.prevent="inputBlurHandler($event, item)"class="column-item item1"><el-inputclass="item__input"v-model="tableData[index].date"type="textarea"resize="none"placeholder="请输入内容"autosize></el-input></div><divstyle="flex: 1"@click.prevent="inputBlurHandler($event, item)"class="column-item item2"><el-inputclass="item__input"v-model="tableData[index].name"type="textarea"resize="none"placeholder="请输入内容"autosize></el-input></div></div></div></div></div>
</template><script>
export default {name: "Batch",data() {return {// 下拉选项showedit: false,// 表格数据tableData: [],// 需要编辑的属性editProp: ["date", "name"],columns: [{ label: "流程顺序", prop: "date", width: 100, align: "center" },{ label: "流程名称", prop: "name", width: null },],current_Y_X: null,};},computed: {foodLabel() {return (val) => {return this.options.find((o) => o.value === val).label;};},},mounted() {this.tableData = [{date: "你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好.",name: "王小虎",food: "选项5",},{date: "你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好.",name: "王小虎",food: "选项5",},{date: "你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好.",name: "王小虎",food: "选项5",},{date: "你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好.",name: "王小虎",food: "选项5",},{date: "你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好.",name: "王小虎",food: "选项5",},{date: "你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好.",name: "王小虎",food: "选项5",},{date: "你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好.",name: "王小虎",food: "选项5",},{date: "你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好.",name: "王小虎",food: "选项5",},{date: "-02",name: "王小虎",food: "选项5",},{date: "-02",name: "王小虎",food: "选项5",},{date: "2016-05-04",name: "王小虎",food: "选项5",},{date: "2016-05-01",name: "王小虎",food: "选项5",},{date: "2016-05-03",name: "王小虎",food: "选项5",},];},methods: {inputBlurHandler(event, data) {const span = event.target;if (span.className.includes("column-item")) {span.children[0].children[0].focus();}},},
};
</script><style lang="scss">
.textarea-item {border-bottom: #f1f1f1 1px solid;.textarea-row {display: flex;justify-content: start;flex-wrap: nowrap;.column-item {&:first-child {border-right: #f1f1f1 1px solid;}.item__input {padding: 5px;textarea {background-color: rebeccapurple;width: 100%;border: none; /* 去除边框 */background-color: transparent; /* 透明背景 */padding: 0 !important;outline: none; /* 去除聚焦时的轮廓线 */margin: 0; /* 去除外边距 */font-size: 12px !important; /* 设置字体大小,与 p 标签一致 */color: inherit; /* 继承父元素的字体颜色 */line-height: 1;// white-space: pre-wrap;text-align: start;font-family: Avenir, Helvetica, Arial, sans-serif !important;overflow: hidden;// word-break: break-all !important;// font-family: youjian !important;}}}}
}
.table-input-box {overflow-y: auto;
}
</style>


http://www.mrgr.cn/news/80376.html

相关文章:

  • react 使用 PersistGate 白屏解决方案
  • Android monitor.exe不支持jdk8以上
  • Guava 提供了集合操作 `List`、`Set` 和 `Map` 三个工具类
  • 新建Ubuntu系统配置步骤
  • 洛谷题解P1219 [USACO1.5] 八皇后 Checker Challenge
  • 基于Arduino蹲便器的自动清洁系统(论文+源码)
  • Next.js流量教程:核心 Web Vitals的改善
  • ARM Cortex-A7 MPCore 架构
  • XML基础学习
  • 【时间序列分析】皮尔森相关系数理论基础及python代码实现
  • Spring Framework 路径遍历漏洞复现(CVE-2024-38819)
  • Redis篇-21--运维篇3-集群(分片,水平扩展,高可用,集群配置案例,扩展哨兵案例)
  • .Net WebAPI(一)
  • 【网络安全】Web Timing 和竞争条件攻击:揭开隐藏的攻击面
  • Vulhub:Redis[漏洞复现]
  • 交通道路上的车辆,人,自行车摩托车自动识别数据集,使用YOLO,COCO,VOC格式对2998张原始图片标注
  • 51c视觉~YOLO~合集6~
  • C/C++包含头文件的两种方式:尖括号方式 (<>)和双引号方式 (““)的区别
  • ubuntu服务器木马类挖矿程序排查、及安全管理总结
  • 【CSS in Depth 2 精译_079】第 13 章:渐变、阴影与混合模式概述 + 13.1:CSS 渐变效果(上)——使用多个颜色节点
  • 深度学习——激活函数、损失函数、优化器
  • 简单了解一下 Go 语言的构建约束?
  • F-Cooper论文精读
  • Apache Kylin最简单的解析、了解
  • 基于区块链技术的新能源管理平台
  • 【Linux】结构化命令