VUE element-ui 之table表格双表头、表头内插入输入框

简介: VUE element-ui 之table表格双表头、表头内插入输入框

步骤:
模板部分:
就是在表头中嵌套表头,slot="header"是重点,两个表头内label、prop需一致,否则表格内容不显示

        <el-table-column
            type="selection"
            width="55"
            align="center"
            :selectable="checkboxT"
          >
            <el-table-column
              type="selection"
              width="55"
              align="center"
            />
          </el-table-column>
          <!-- slot="header" -->
          <el-table-column label="序号" width="70" align="center">
            <el-table-column label="" width="70" align="center">
              <template slot-scope="scope">
                {{ (scope.$index + 1) }}
              </template>
            </el-table-column>
          </el-table-column>
          <el-table-column label="订单编号" width="130" prop="sale_order_num" :show-overflow-tooltip="true">
            <el-table-column label="订单编号" width="130" prop="sale_order_num" :show-overflow-tooltip="true">
              <template slot="header">
                <el-input v-model="query.saleOrderNum" size="mini" placeholder="请输入" />
              </template>
            </el-table-column>
          </el-table-column>
          <el-table-column label="自编号" width="130" prop="personal_num" :show-overflow-tooltip="true">
            <el-table-column label="自编号" width="130" prop="personal_num" :show-overflow-tooltip="true">
              <template slot="header">
                <el-input v-model="query.personalNum" size="mini" placeholder="请输入" />
              </template>
            </el-table-column>
          </el-table-column>

不需要配置输入框的列:

          <el-table-column label="单价(元/㎡)" width="130" prop="price" sortable :show-overflow-tooltip="true">
            <el-table-column label="" width="130" prop="price" :show-overflow-tooltip="true">
              <template slot="header" />
            </el-table-column>
          </el-table-column>

来看效果:
在这里插入图片描述
表格自带排序不受影响,且表头固定。

相关文章
|
11天前
|
数据安全/隐私保护
Element UI 密码输入框--可切换显示隐藏,自定义图标
Element UI 密码输入框--可切换显示隐藏,自定义图标
9 0
|
11天前
Element UI 表格【列宽自适应】
Element UI 表格【列宽自适应】
8 0
|
11天前
Element UI 【表格合计】el-table 实战范例 -- 添加单位,自定义计算逻辑
Element UI 【表格合计】el-table 实战范例 -- 添加单位,自定义计算逻辑
10 0
|
11天前
Element UI 带快捷编辑的多行输入框(含光标位置的获取和指定)
Element UI 带快捷编辑的多行输入框(含光标位置的获取和指定)
8 0
|
11天前
|
前端开发
Element UI 表格常用改造(表头添加注释、翻页连续序号【内含前端分页】)
Element UI 表格常用改造(表头添加注释、翻页连续序号【内含前端分页】)
16 0
|
2月前
|
前端开发 搜索推荐 开发者
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
|
2月前
|
JavaScript 前端开发 开发者
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
|
2月前
|
前端开发 JavaScript API
SAP UI5 sap.ui.require.toUrl 的作用介绍
SAP UI5 sap.ui.require.toUrl 的作用介绍
|
2月前
|
JSON 前端开发 测试技术
SAP UI5 sap.ui.core.util.MockServer.simulate 方法介绍
SAP UI5 sap.ui.core.util.MockServer.simulate 方法介绍
使用 SAP UI5 Event Bus 机制,修复 SAP UI5 分页显示数据的一个 bug 试读版
使用 SAP UI5 Event Bus 机制,修复 SAP UI5 分页显示数据的一个 bug 试读版