diff --git a/src/components/PageContent/index.vue b/src/components/PageContent/index.vue
index d7e88e8e..498971bc 100644
--- a/src/components/PageContent/index.vue
+++ b/src/components/PageContent/index.vue
@@ -4,7 +4,7 @@
-
+
@@ -43,46 +43,34 @@
-
-
- {{ item.text }}
-
-
-
-
- {{ item.text }}
-
-
+
+ {{ item.text }}
+
+
-
+
-
-
全选
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
{{ (col.selectList ?? {})[scope.row[col.prop]] }}
-
-
-
-
-
-
+
+
-
-
-
-
-
-
+
+
{{ `${col.priceFormat ?? "¥"}${scope.row[col.prop]}` }}
-
-
-
-
-
- {{ scope.row[col.prop] }}%
-
-
-
-
-
-
+
+
+ {{ scope.row[col.prop] }}%
+
+
+
-
-
-
-
-
-
+
+
{{
useDateFormat(
scope.row[col.prop],
@@ -209,13 +174,12 @@
).value
}}
-
-
-
-
-
-
-
+
+
+
@@ -240,64 +204,36 @@
-
-
- {{ item.text }}
-
-
-
-
- {{ item.text }}
-
-
+
+ {{ item.text }}
+
-
-
-
-
-
-
+
+
-
-
-
-
-
-
+
+
@@ -341,7 +277,7 @@ export interface IContentConfig {
// 主键名(默认为id)
pk?: string;
// 表格工具栏(默认支持add,delete,export,也可自定义)
- toolbar: Array<
+ toolbar?: Array<
| "add"
| "delete"
| "export"
@@ -405,7 +341,9 @@ defineExpose({ fetchPageData, exportPageData });
// 主键
const pk = props.contentConfig.pk ?? "id";
-// 表格工具栏右侧图标
+// 表格左侧工具栏
+const toolbar = props.contentConfig.toolbar ?? ["add", "delete"];
+// 表格右侧工具栏
const defaultToolbar = props.contentConfig.defaultToolbar ?? [
"refresh",
"filter",
diff --git a/src/views/demo/curd/config/content2.ts b/src/views/demo/curd/config/content2.ts
new file mode 100644
index 00000000..08290cb7
--- /dev/null
+++ b/src/views/demo/curd/config/content2.ts
@@ -0,0 +1,91 @@
+import type { IContentConfig } from "@/components/PageContent/index.vue";
+
+const contentConfig: IContentConfig = {
+ pageName: "sys:user",
+ indexAction: function (params) {
+ return Promise.resolve({
+ total: 2,
+ list: [
+ {
+ id: 1,
+ username: "tom",
+ avatar:
+ "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
+ percent: 99,
+ price: 10,
+ url: "https://www.baidu.com",
+ icon: "el-icon-setting",
+ gender: 1,
+ status: 1,
+ createTime: 1715647982437,
+ },
+ {
+ id: 2,
+ username: "jerry",
+ avatar:
+ "https://oss.youlai.tech/youlai-boot/2023/05/16/811270ef31f548af9cffc026dfc3777b.gif",
+ percent: 88,
+ price: 999,
+ url: "https://www.google.com",
+ icon: "el-icon-user",
+ gender: 0,
+ status: 0,
+ createTime: 1715648977426,
+ },
+ ],
+ });
+ },
+ cols: [
+ { type: "selection", width: 50, align: "center" },
+ { label: "ID", align: "center", prop: "id" },
+ { label: "用户名", align: "center", prop: "username" },
+ { label: "图片", align: "center", prop: "avatar", templet: "image" },
+ {
+ label: "百分比",
+ align: "center",
+ prop: "percent",
+ templet: "percent",
+ },
+ {
+ label: "价格",
+ align: "center",
+ prop: "price",
+ templet: "price",
+ priceFormat: "$",
+ },
+ { label: "链接", align: "center", prop: "url", width: 180, templet: "url" },
+ { label: "图标", align: "center", prop: "icon", templet: "icon" },
+ {
+ label: "列表值",
+ align: "center",
+ prop: "gender",
+ templet: "list",
+ selectList: { 0: "女", 1: "男" },
+ },
+ {
+ label: "自定义",
+ align: "center",
+ prop: "status",
+ templet: "custom",
+ slotName: "status",
+ },
+ {
+ label: "创建时间",
+ align: "center",
+ prop: "createTime",
+ minWidth: 120,
+ templet: "date",
+ dateFormat: "YYYY/MM/DD HH:mm:ss",
+ },
+ {
+ label: "操作",
+ align: "center",
+ fixed: "right",
+ width: 150,
+ templet: "tool",
+ operat: ["edit", "delete"],
+ },
+ ],
+};
+
+export default contentConfig;