编辑按钮实现
This commit is contained in:
@@ -60,7 +60,8 @@ import {ElMessageBox, ElMessage} from 'element-plus';
|
||||
|
||||
export default {
|
||||
name: 'RawMaterialTable',
|
||||
setup() {
|
||||
emits: ['edit'], // 声明触发的事件
|
||||
setup(props, { emit }) {
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const searchKeyword = ref('');
|
||||
@@ -155,6 +156,10 @@ export default {
|
||||
});
|
||||
};
|
||||
|
||||
const handleEdit = (row) => {
|
||||
emit('edit', row); // 触发 edit 事件,并传递当前行数据
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
fetchRawMaterials();
|
||||
});
|
||||
@@ -170,10 +175,10 @@ export default {
|
||||
handleSizeChange,
|
||||
handleCurrentChange,
|
||||
handleExpandChange,
|
||||
handleEdit: (row) => console.log('edit', row),
|
||||
handleEdit,
|
||||
handleDelete,
|
||||
fetchRawMaterials, // 将方法暴露出去
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
Reference in New Issue
Block a user