index.vue 834 B

123456789101112131415161718192021222324252627282930313233343536
  1. <script lang="ts" setup>
  2. import { h } from 'vue';
  3. import { alert, VbenButton } from '@vben/common-ui';
  4. import { Result } from 'ant-design-vue';
  5. function showAlert() {
  6. alert('This is an alert message');
  7. }
  8. function showIconAlert() {
  9. alert({
  10. content: 'This is an alert message with icon',
  11. icon: 'success',
  12. });
  13. }
  14. function showCustomAlert() {
  15. alert({
  16. buttonAlign: 'center',
  17. content: h(Result, {
  18. status: 'success',
  19. subTitle: '已成功创建订单。订单ID:2017182818828182881',
  20. title: '操作成功',
  21. }),
  22. });
  23. }
  24. </script>
  25. <template>
  26. <div class="flex gap-4">
  27. <VbenButton @click="showAlert">Alert</VbenButton>
  28. <VbenButton @click="showIconAlert">Alert With Icon</VbenButton>
  29. <VbenButton @click="showCustomAlert">Alert With Custom Content</VbenButton>
  30. </div>
  31. </template>