index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <script lang="ts" setup>
  2. import { Page } from '@vben/common-ui';
  3. import { Button, Card, message, notification, Space } from 'ant-design-vue';
  4. type NotificationType = 'error' | 'info' | 'success' | 'warning';
  5. function info() {
  6. message.info('How many roads must a man walk down');
  7. }
  8. function error() {
  9. message.error({
  10. content: 'Once upon a time you dressed so fine',
  11. duration: 2500,
  12. });
  13. }
  14. function warning() {
  15. message.warning('How many roads must a man walk down');
  16. }
  17. function success() {
  18. message.success('Cause you walked hand in hand With another man in my place');
  19. }
  20. function notify(type: NotificationType) {
  21. notification[type]({
  22. duration: 2500,
  23. message: '说点啥呢',
  24. type,
  25. });
  26. }
  27. </script>
  28. <template>
  29. <Page
  30. description="支持多语言,主题功能集成切换等"
  31. title="Ant Design Vue组件使用演示"
  32. >
  33. <Card class="mb-5" title="按钮">
  34. <Space>
  35. <Button>Default</Button>
  36. <Button type="primary"> Primary </Button>
  37. <Button> Info </Button>
  38. <Button danger> Error </Button>
  39. </Space>
  40. </Card>
  41. <Card class="mb-5" title="Message">
  42. <Space>
  43. <Button @click="info"> 信息 </Button>
  44. <Button danger @click="error"> 错误 </Button>
  45. <Button @click="warning"> 警告 </Button>
  46. <Button @click="success"> 成功 </Button>
  47. </Space>
  48. </Card>
  49. <Card class="mb-5" title="Notification">
  50. <Space>
  51. <Button @click="notify('info')"> 信息 </Button>
  52. <Button danger @click="notify('error')"> 错误 </Button>
  53. <Button @click="notify('warning')"> 警告 </Button>
  54. <Button @click="notify('success')"> 成功 </Button>
  55. </Space>
  56. </Card>
  57. </Page>
  58. </template>