diff --git a/src/components/CURD/PageModal.vue b/src/components/CURD/PageModal.vue
index 3d53e394..37854c11 100644
--- a/src/components/CURD/PageModal.vue
+++ b/src/components/CURD/PageModal.vue
@@ -66,6 +66,14 @@
+
+
+
+
+
+
+
+
func());
// 获取表单数据
function getFormData(key?: string) {
- return key === undefined ? formData : formData[key] ?? undefined;
+ return key === undefined ? formData : (formData[key] ?? undefined);
}
// 设置表单值
diff --git a/src/components/CURD/types.ts b/src/components/CURD/types.ts
index 97f4d834..229dc0bb 100644
--- a/src/components/CURD/types.ts
+++ b/src/components/CURD/types.ts
@@ -220,6 +220,7 @@ export type IFormItems = Array<{
| "input"
| "select"
| "radio"
+ | "switch"
| "checkbox"
| "tree-select"
| "date-picker"
diff --git a/src/views/demo/curd/config/add.ts b/src/views/demo/curd/config/add.ts
index 023548c4..38bcf59d 100644
--- a/src/views/demo/curd/config/add.ts
+++ b/src/views/demo/curd/config/add.ts
@@ -103,14 +103,26 @@ const modalConfig: IModalConfig = {
maxlength: 50,
},
},
+ // {
+ // label: "状态",
+ // prop: "status",
+ // type: "radio",
+ // options: [
+ // { label: "正常", value: 1 },
+ // { label: "禁用", value: 0 },
+ // ],
+ // initialValue: 1,
+ // },
{
label: "状态",
prop: "status",
- type: "radio",
- options: [
- { label: "正常", value: 1 },
- { label: "禁用", value: 0 },
- ],
+ type: "switch",
+ attrs: {
+ activeText: "正常",
+ inactiveText: "禁用",
+ activeValue: 1,
+ inactiveValue: 0,
+ },
initialValue: 1,
},
],
diff --git a/src/views/demo/curd/config/edit.ts b/src/views/demo/curd/config/edit.ts
index 983546a4..bbcf2cb1 100644
--- a/src/views/demo/curd/config/edit.ts
+++ b/src/views/demo/curd/config/edit.ts
@@ -107,14 +107,26 @@ const modalConfig: IModalConfig = {
maxlength: 50,
},
},
+ // {
+ // label: "状态",
+ // prop: "status",
+ // type: "radio",
+ // options: [
+ // { label: "正常", value: 1 },
+ // { label: "禁用", value: 0 },
+ // ],
+ // initialValue: 1,
+ // },
{
- label: "状态",
+ label: "状态123",
prop: "status",
- type: "radio",
- options: [
- { label: "正常", value: 1 },
- { label: "禁用", value: 0 },
- ],
+ type: "switch",
+ attrs: {
+ activeText: "正常",
+ inactiveText: "禁用",
+ activeValue: 1,
+ inactiveValue: 0,
+ },
},
],
};