feat: form support reverse action buttons (#5108)
* feat: form support reverse action buttons * fix: submit button class
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Button, Card, message, Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
|
||||
const isReverseActionButtons = ref(false);
|
||||
|
||||
const [BaseForm, formApi] = useVbenForm({
|
||||
// 翻转操作按钮的位置
|
||||
actionButtonsReverse: isReverseActionButtons.value,
|
||||
// 所有表单项共用,可单独在表单内覆盖
|
||||
commonConfig: {
|
||||
// 所有表单项
|
||||
@@ -83,6 +89,7 @@ function handleClick(
|
||||
| 'labelWidth'
|
||||
| 'resetDisabled'
|
||||
| 'resetLabelWidth'
|
||||
| 'reverseActionButtons'
|
||||
| 'showAction'
|
||||
| 'showResetButton'
|
||||
| 'showSubmitButton'
|
||||
@@ -158,6 +165,11 @@ function handleClick(
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'reverseActionButtons': {
|
||||
isReverseActionButtons.value = !isReverseActionButtons.value;
|
||||
formApi.setState({ actionButtonsReverse: isReverseActionButtons.value });
|
||||
break;
|
||||
}
|
||||
case 'showAction': {
|
||||
formApi.setState({ showDefaultActions: true });
|
||||
break;
|
||||
@@ -177,6 +189,7 @@ function handleClick(
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case 'updateResetButton': {
|
||||
formApi.setState({
|
||||
resetButtonOptions: { disabled: true },
|
||||
@@ -226,6 +239,9 @@ function handleClick(
|
||||
<Button @click="handleClick('resetLabelWidth')">还原labelWidth</Button>
|
||||
<Button @click="handleClick('disabled')">禁用表单</Button>
|
||||
<Button @click="handleClick('resetDisabled')">解除禁用</Button>
|
||||
<Button @click="handleClick('reverseActionButtons')">
|
||||
翻转操作按钮位置
|
||||
</Button>
|
||||
<Button @click="handleClick('hiddenAction')">隐藏操作按钮</Button>
|
||||
<Button @click="handleClick('showAction')">显示操作按钮</Button>
|
||||
<Button @click="handleClick('hiddenResetButton')">隐藏重置按钮</Button>
|
||||
|
Reference in New Issue
Block a user