编辑列的功能

//列信息中配置:scopedSlots: { customRender: 'editname' }//<template slot="editname" slot-scope="text, record">  <editable-cell :col="'name'" :record="record" @change="handleEditname(record, 'name', $event)"/></template>//模板&方法const EditableCell = {  props: {    record: Object,    col: String  },  data () {    return {      editable: false,      inputtext: ""    };  },  methods: {    handleChange (e) {      const value = e.target.value;      this.record[this.col] = value    },    check () {      this.editable = false;      this.$emit('change', this.record[this.col]);    },    edit () {      this.editable = true      this.inputtext = this.record[this.col]    },    close () {      this.editable = false      this.record[this.col] = this.inputtext    }  },  render () {    if (this.editable) {      return (        <div class="editable-cell">          <div class="editable-cell-input-wrapper">            <a-input value={this.record[this.col]} {...{ on: { pressEnter: this.check, change: this.handleChange } }} />            <a-icon type="check" class="editable-cell-icon-check" {...{ on: { click: this.check } }} />            <a-icon type="close" style="margin-left:8px;" {...{ on: { click: this.close } }} />          </div>        </div>      )    } else {      return (        <div class="editable-cell">          <div class="editable-cell-text-wrapper">            {this.record[this.col] || ''}            <a-icon type="edit" class="editable-cell-icon" {...{ on: { click: this.edit } }} />          </div>        </div>      )    }  }};//方法handleEditname (record, dataIndex, value) {}


©著作权归作者所有:来自51CTO博客作者爱笑嘚蛋蛋的原创作品,如需转载,请注明出处,否则将追究法律责任

更多相关文章

  1. 推荐一种Python安装的方法
  2. 如何找到属于自己高效学习方法?
  3. Pyecharts制作地图的几种方法评析
  4. 词云图的几种制作方法评测,你pick哪款
  5. 便捷搭建 Zookeeper 服务器的方法,好用,收藏~
  6. 自学系列 | 就谈自学方法!
  7. php性能优化的方法介绍
  8. PHP操作Redis数据库常用方法(总结)
  9. php中比较两个数组差异的方法

随机推荐

  1. Android(安卓)Window类解析
  2. android 开发-Process and Thread
  3. cxf android客户端简单访问
  4. android volley https
  5. Ubuntu 14.04烧Nexus 5手机
  6. 修改文件夹权限
  7. android,view的执行过程onDraw、onSizeCha
  8. Android(安卓)ApiDemos示例解析(88):Medi
  9. Android获取apk的版本及包名等信息
  10. Android 计算器编程实现