这类表格样页面有没更好的实现方式。
我看网上都是一行一行,没找到过这类教程
直接循环创建不就好了, 最后通过form获取表格里的值
找一个可编辑表格的组件就能实现 https://vxetable.cn/#/table/start/upgrade
楼上的大佬说的很对,使用 第三方的 Vxe-table 确实更快捷能够实现,我们项目的进销存表单也是使用的vxe-table
再补充一个
<el-table-column
show-overflow-tooltip
min-width="80"
label="xxxx">
<template slot-scope="scope">
<el-input v-if="methods === 'edit'" type="textarea" resize="none" autosize v-model="scope.row.aaa"></el-input>
<span v-else style="display: inline-block;width: 100%;height: 100%;white-space: pre-wrap;margin: 5px 0">{{scope.row.typeLabel}}</span>
</template>
</el-table-column>
这里用textarea而不用普通input输入框是因为考虑到用户输入的东西可能会多,普通input不支持换行显示,就只能通过左右滚动查看输入的是啥,用户体验性不好