Skip to content

Commit

Permalink
perf: 表单重置按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Oct 24, 2023
1 parent 4959c2e commit 19c74e9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions packages/fast-crud/src/components/crud/fs-form-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ export default defineComponent({
}
}

async function reset() {
await formRef.value.reset();
}

function getFormData() {
return formRef.value?.getFormData();
}
Expand All @@ -207,6 +211,12 @@ export default defineComponent({
close();
}
},
reset: {
text: t("fs.form.reset"),
onClick: () => {
reset();
}
},
ok: {
text: t("fs.form.ok"),
type: "primary",
Expand Down
3 changes: 2 additions & 1 deletion packages/fast-crud/src/locale/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default {
},
form: {
cancel: "cancel",
ok: "ok"
ok: "ok",
reset: "reset"
},
actionbar: { add: "add" },
toolbar: {
Expand Down
3 changes: 2 additions & 1 deletion packages/fast-crud/src/locale/lang/zh-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default {
},
form: {
cancel: "取消",
ok: "确定"
ok: "确定",
reset: "重置"
},
actionbar: { add: "添加" },
toolbar: {
Expand Down

0 comments on commit 19c74e9

Please sign in to comment.