Skip to content

当后台删除数据后 怎么刷新表格 #7

@ruanzy

Description

@ruanzy
// 自定义列组件
Vue.component('table-operation', {
  template: `<span>
    <a href="" @click.stop.prevent="update(rowData,index)">编辑</a>&nbsp;
    <a href="" @click.stop.prevent="deleteRow(rowData,index)">删除</a>
    </span>`,
  props: {
    rowData: {
      type: Object
    },
    field: {
      type: String
    },
    index: {
      type: Number
    }
  },
  methods: {
    update () {
      var rowData = this.rowData;
      var $Modal = this.$Modal;
      var options = {
        show: true,
        heigt: 500,
        width: 450,
        title: '编辑',
        component: {
          name: 'edittr',
          data: rowData
        },
        buttons: [
          {
            text: '确定',
            action: function(){
              
              alert(rowData.name);
            }
          },
          {
            text: '取消',
            action: function(){
              $Modal.close(d)
            }
          }
        ]
      }
      var d = $Modal.dialog(options)
    },
    deleteRow () {
      var rowData = this.rowData;
      this.$Modal.confirm('确定要删除数据吗?', function(v){
        if(v){
          alert(rowData.name)
          //后台删除数据
          //这里怎么获得table对象来操作
        }
      })
    }
  }
})

这里的deleteRow 方法, 后台删除数据后,怎么刷新表格?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions