This commit is contained in:
2023-08-24 19:24:00 +08:00
parent 5c39fb35f2
commit 9bd55a0ab0
8 changed files with 129 additions and 15 deletions

View File

@@ -148,13 +148,22 @@ const close = () => {
form.value = {}
}
const add = () => {
actionTitle.value = "新增"
if (!actionTitle.value) {
actionTitle.value = "新增"
} else {
actionTitle.value += "新增"
}
currentAction.value = "add"
form.value = {}
open()
}
const edit = (data) => {
actionTitle.value = "编辑"
if (!actionTitle.value) {
actionTitle.value = "编辑"
} else {
actionTitle.value += "编辑"
}
currentAction.value = "edit"
form.value = {}
for (let i in data) form.value[i] = data[i]
@@ -357,5 +366,5 @@ const getFormColumns = async (type = "add") => {
await init()
return formColumns.value
}
defineExpose({ add, edit, currentAction, form, getFormColumns })
defineExpose({ add, edit, currentAction, form, getFormColumns, actionTitle })
</script>

View File

@@ -31,7 +31,7 @@
</div>
<div class="_crud-content">
<div class="operation-tools lg:flex justify-between mb-3" ref="crudOperationRef">
<a-space class="lg:flex block lg:inline-block">
<a-space class="lg:flex block">
<slot name="tableBeforeButtons"></slot>
<slot name="tableButtons">
<a-button