编辑按钮实现

This commit is contained in:
2025-11-21 17:48:11 +08:00
parent 595a2ef47f
commit 13f2692448
2 changed files with 56 additions and 16 deletions

View File

@@ -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>