in-content-demo.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <script lang="ts" setup>
  2. import { ref } from 'vue';
  3. import { useVbenDrawer } from '@vben/common-ui';
  4. import { Input, message } from 'ant-design-vue';
  5. import { useVbenForm } from '#/adapter/form';
  6. const value = ref('');
  7. const [Form] = useVbenForm({
  8. schema: [
  9. {
  10. component: 'Input',
  11. componentProps: {
  12. placeholder: 'KeepAlive测试:内部组件',
  13. },
  14. fieldName: 'field1',
  15. hideLabel: true,
  16. label: '字段1',
  17. },
  18. ],
  19. showDefaultActions: false,
  20. });
  21. const [Drawer, drawerApi] = useVbenDrawer({
  22. destroyOnClose: false,
  23. onCancel() {
  24. drawerApi.close();
  25. },
  26. onConfirm() {
  27. message.info('onConfirm');
  28. // drawerApi.close();
  29. },
  30. });
  31. </script>
  32. <template>
  33. <Drawer append-to-main title="基础抽屉示例" title-tooltip="标题提示内容">
  34. <template #extra> extra </template>
  35. 此弹窗指定在内容区域打开,并且在关闭之后弹窗内容不会被销毁
  36. <Input
  37. v-model:value="value"
  38. placeholder="KeepAlive测试:connectedComponent"
  39. />
  40. <Form />
  41. </Drawer>
  42. </template>