element ui 表格可编辑功能

 

 

思路解析:

点击修改,将单元格内改变成输入框格式,点击保存去调取接口

复制代码
 <!-- 表格主体 -->
          <template slot-scope="scope">
            <span v-if="scope.row.isSet">
              <el-input
                size="large"
                placeholder="请输入内容"
                v-model="scope.row[temTableData.keyList[index]]"
                @input="inputChange($event)"
              >
              </el-input>
            </span>
            <span v-else>{{ scope.row[temTableData.keyList[index]] }}</span>
          </template>


inputChange(e) {  //解决空字符串时 input 不可以输入字段
      this.$forceUpdate();
 },
复制代码

 

posted @   沁猿春  阅读(1144)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示