Elementui notes: el-table deletes a row of records (2)

In the previous article , use @row-clickto get the data of the currently clicked record, and then call the delete method

insert image description here

In fact, the "Delete" button is wrapped in a template. You can use the scope to get the data of the currently selected row, and you don't need @row-clickto assist to get the data of the selected row. The code at that time is as follows:

<el-table-column prop="" label="操作">
    <template>
        <div class="flex-c-a">
            <span class="delete-btn">删除</span>
        </div>
    </template>
</el-table-column>

If you directly use scope to get the current row record, you can do this:
html:

<el-table-column prop="" label="操作" align="center">
    <template>
        <div class="flex-c-a">
            <span class="delete-btn" @click="removeFundBtn(scope.row)">删除</span>
        </div>
    </template>
</el-table-column>

The deleted method is still the same, and the effect is the same

Guess you like

Origin blog.csdn.net/qq_43523725/article/details/123258512