refactor: ♻️ 支持CURD演示示例切换

This commit is contained in:
cshaptx4869
2024-06-13 15:21:13 +08:00
parent 2b03b2d229
commit 8fad7f48a1
2 changed files with 79 additions and 64 deletions

View File

@@ -5,7 +5,9 @@ const contentConfig: IContentConfig = {
table: {
showOverflowTooltip: true,
},
toolbar: [],
indexAction: function (params) {
// 模拟发起网络请求获取列表数据
// console.log("indexAction:", params);
return Promise.resolve({
total: 2,
@@ -44,11 +46,13 @@ const contentConfig: IContentConfig = {
});
},
modifyAction(data) {
console.log("modifyAction:", data);
// 模拟发起网络请求修改字段
// console.log("modifyAction:", data);
ElMessage.success(JSON.stringify(data));
return Promise.resolve(null);
},
cols: [
{ type: "selection", width: 50, align: "center" },
{ type: "index", width: 50, align: "center" },
{ label: "ID", align: "center", prop: "id", show: false },
{ label: "用户名", align: "center", prop: "username" },
{ label: "图片", align: "center", prop: "avatar", templet: "image" },
@@ -106,14 +110,6 @@ const contentConfig: IContentConfig = {
templet: "date",
dateFormat: "YYYY/MM/DD HH:mm:ss",
},
{
label: "操作",
align: "center",
fixed: "right",
width: 150,
templet: "tool",
operat: ["edit", "delete"],
},
],
};