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 @ 2022-02-28 20:21  沁猿春  阅读(1183)  评论(0)    收藏  举报