Element删除页面数据后,后台少查询一次

相关代码如下:

<el-table :data="tableData" >
    <el-table-column >
        <template slot-scope="scope">
            <el-button type="danger" icon="el-icon-minus" class='addIcon' @click="deleteRow(scope.row)">
            </el-button>
        </template>
    </el-table-column>
</el-table>
deleteRow(row) {
    this.$confirm('确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    }).then(() => {
        this.axios.del(this.url.delUrl + row.serialid, {showLoading: true})
            .then((res) => {
                let result = res.data;
                if (result.code == 1) {
                    let i = this.tableData.findIndex((value) => value.serialid == row.serialid);
                    this.tableData.splice(i, 1);
                    this.$message.success(result.msg);
                } else {
                    this.$message.error(result.msg);
                }
            })
    }).catch(() => {

    });
}

end

posted @ 2019-11-21 18:31  xh_Blog  阅读(207)  评论(0编辑  收藏  举报