loading.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <kk-button type="primary" loading>Loading</kk-button>
  3. <kk-button type="primary" :loading-icon="Eleme" loading>Loading</kk-button>
  4. <kk-button type="primary" loading>
  5. <template #loading>
  6. <div class="custom-loading">
  7. <svg class="circular" viewBox="-10, -10, 50, 50">
  8. <path
  9. class="path"
  10. d="
  11. M 30 15
  12. L 28 17
  13. M 25.61 25.61
  14. A 15 15, 0, 0, 1, 15 30
  15. A 15 15, 0, 1, 1, 27.99 7.5
  16. L 15 15
  17. "
  18. style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"
  19. />
  20. </svg>
  21. </div>
  22. </template>
  23. Loading
  24. </kk-button>
  25. </template>
  26. <script lang="ts" setup>
  27. import { KkButton } from 'kankan-components'
  28. import { Eleme } from '@kankan-components/icons-vue'
  29. </script>
  30. <style scoped>
  31. .kk-button .custom-loading .circular {
  32. margin-right: 6px;
  33. width: 18px;
  34. height: 18px;
  35. animation: loading-rotate 2s linear infinite;
  36. }
  37. .kk-button .custom-loading .circular .path {
  38. animation: loading-dash 1.5s ease-in-out infinite;
  39. stroke-dasharray: 90, 150;
  40. stroke-dashoffset: 0;
  41. stroke-width: 2;
  42. stroke: var(--kk-button-text-color);
  43. stroke-linecap: round;
  44. }
  45. </style>