首页 > 其他分享 >el-table中header里面写多层循环el-input无法修改其值

el-table中header里面写多层循环el-input无法修改其值

时间:2023-07-04 18:13:38浏览次数:32  
标签:el obj index value header input

之前看别人加了

 @input.native="change($event, index)" 


change(e, index) {
      console.log('e', e, e.target.value);
      // this.tableColumns[index].fieldName = e;
      let obj = Object.assign({}, obj, { fieldName: e.target.value });
      this.$set(this.tableColumns, index, obj);

      this.$forceUpdate();
    }

但其实并不需要,只需要在template的slot="header"后面加里面加:slot-scope="scope"
如下代码:


<el-table :data="tableData" style="width: 100%">
      <el-table-column
        v-for="(column, index) in tableColumns"
        :prop="column.fieldName"
        :key="column.id"
        min-width="100"
      >
        <template slot="header" slot-scope="scope">
          <div class="header-title">
            <label>{{ column.fieldRemarks }}</label>
            <el-popover>
              <el-form :model="column" :rules="rules">
                <el-form-item label="字段英文名(不可修改)" prop="fieldName">
                  <el-input v-model="column.fieldName"></el-input>
                </el-form-item>
                <!-- @input.native="change($event, index)" -->
                <el-form-item label="字段标题" prop="fieldRemarks">
                  <el-input v-model="column.fieldRemarks"></el-input>
                </el-form-item>
                <el-form-item label="字段类型" prop="fieldType">
                  <el-select v-model="column.fieldType">
                    <el-option
                      v-for="item in fieldTypeOption"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-form>

              <div
                class="icon-con"
                slot="reference"
                @click="handleEdit(index, column.ifEdit)"
              >
                <i class="el-icon-arrow-down" v-if="column.ifEdit"></i>
                <i class="el-icon-arrow-up" v-else></i>
              </div>
            </el-popover>
          </div>
        </template>
        <template slot-scope="scope">
          <el-input v-model="scope.row[column.fieldName]"></el-input>
        </template>
      </el-table-column>
      <el-table-column>
        <template slot="header">
          <el-button
            v-no-more-click
            type="text"
            class="el-icon-plus"
            @click="addColumn"
          ></el-button>
        </template>
      </el-table-column>
    </el-table>

标签:el,obj,index,value,header,input
From: https://www.cnblogs.com/sinceForever/p/17526460.html

相关文章

  • 【VMware Workstation】此平台不支持虚拟化的Intel VT-x/EPT。不使用虚拟化的Intel VT
    今天在使用虚拟机启动redhat8.x系统时一直报错:尝试了网上很多方案无果,解决方案是修改hypervisorlaunchtype为off打开PowerShell运行:bcdedit/sethypervisorlaunchtypeoff重启电脑即可。......
  • Java 委托和继承(Delegation and Inheritance)
    https://blog.csdn.net/Seriousplus/article/details/80462722委派和继承都是为了提高代码的复用性,只是方式不同。委派:一个对象请求另一个对象的功能,捕获一个操作并将其发送到另一个对象。继承:利用extends来扩展一个基类。Delegation(委托)委托依赖于动态绑定,因为它要求特定......
  • python接口自动化封装导出excel方法和读写excel数据
    一、首先需要思考,我们在页面导出excel,用python导出如何写入文件的封装前需要确认python导出excel接口返回的是一个什么样的数据类型如下:我们先看下不对返回结果做处理,直接接收数据类型是一个对象,无法获取返回值此时我们需要对返回数据做处理,如下;response.text#响应文本数据......
  • el-tree树点击全选按钮,全部展开并且全选
    先看图:代码如下://全部选中qxClick(){this.isQx=!this.isQx;//判断按钮的状态this.expandAll();if(this.isQx){console.log(this.isQx,"-------------------------------",this.datas);//设置this.$r......
  • shell脚本:将运行容器的日志输出到文件清理服务器上的符合条件的docker镜像
    采集容器日志的shell脚本内容为:点击查看代码#!/bin/bashexportLANG=zh_CN.gb18030.~/.bash_profile#日志放置目录log_path=/aa/bb/cc/dd/eetodaydate=$(date+%Y%m%d)nowdate=$(date+%Y%m%d%H%M)#pod列表dube_pod_id='xx1-servicexx2-servicexx3-servicexx4-se......
  • shell脚本:对开发入库的sql脚本进行检查
    shell脚本内容为:点击查看代码#!/bin/bashexportLANG=en_US.UTF-8exportNLS_LANG="AMERICAN_AMERICA.AL32UTF8"source/etc/profilesource/root/.bash_profileHOME=$(cd$(dirname$0);pwd)DOC_HOME=${HOME}/releasedocDOC_SVN_PATH=http://192.168.xx.xx/bushi......
  • Camstar SSL需要证书下载才能导入excel
    谷歌浏览器F12,点击security,点击ViewCertificate.  下载好了,双击,进行安装 设置:注册表 ......
  • element-ui表格多选
    <template><el-tablesize="medium"v-loading="tableLoading":data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"stripeheight="100%&q......
  • 【Netty】「萌新入门」(三)ChannelFuture 与 CloseFuture
    前言本篇博文是《从0到1学习Netty》中入门系列的第三篇博文,主要内容是介绍Netty中ChannelFuture与CloseFuture的使用,解决连接问题与关闭问题,往期系列文章请访问博主的Netty专栏,博文中的所有代码全部收集在博主的GitHub仓库中;连接问题与ChannelFuture在Netty中,所有的......
  • Element-布局
     Layout布局<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><style>.el-row{margin-bottom:20px;}.el-col......