loading.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <el-button type="primary" loading>Loading</el-button>
  3. <el-button type="primary" :loading-icon="Eleme" loading>Loading</el-button>
  4. <el-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. </el-button>
  25. </template>
  26. <script lang="ts" setup>
  27. import { Eleme } from '@element-plus/icons-vue'
  28. </script>
  29. <style scoped>
  30. .el-button .custom-loading .circular {
  31. margin-right: 6px;
  32. width: 18px;
  33. height: 18px;
  34. animation: loading-rotate 2s linear infinite;
  35. }
  36. .el-button .custom-loading .circular .path {
  37. animation: loading-dash 1.5s ease-in-out infinite;
  38. stroke-dasharray: 90, 150;
  39. stroke-dashoffset: 0;
  40. stroke-width: 2;
  41. stroke: var(--el-button-text-color);
  42. stroke-linecap: round;
  43. }
  44. </style>