index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div class="loading-container">
  3. <el-divider content-position="left">传统loading</el-divider>
  4. <el-button type="primary" @click="handleLoading()">默认效果</el-button>
  5. <el-button type="primary" @click="handleLoading(1)">效果1</el-button>
  6. <el-button type="primary" @click="handleLoading(2)">效果2</el-button>
  7. <el-button type="primary" @click="handleLoading(3)">效果3</el-button>
  8. <el-button type="primary" @click="handleLoading(4)">效果4</el-button>
  9. <el-button type="primary" @click="handleLoading(5)">效果5</el-button>
  10. <el-button type="primary" @click="handleLoading(6)">效果6</el-button>
  11. <el-button type="primary" @click="handleLoading(7)">效果7</el-button>
  12. <el-button type="primary" @click="handleLoading(8)">效果8</el-button>
  13. <el-button type="primary" @click="handleLoading(9)">效果9</el-button>
  14. <br />
  15. <br />
  16. <br />
  17. <el-divider content-position="left">多彩loading</el-divider>
  18. <el-button type="primary" @click="handleColorfullLoading(1)">
  19. 效果1
  20. </el-button>
  21. <el-button type="primary" @click="handleColorfullLoading(2)">
  22. 效果2
  23. </el-button>
  24. <el-button type="primary" @click="handleColorfullLoading(3)">
  25. 效果3
  26. </el-button>
  27. <el-button type="primary" @click="handleColorfullLoading(4)">
  28. 效果4
  29. </el-button>
  30. </div>
  31. </template>
  32. <script>
  33. export default {
  34. name: "Loading",
  35. data() {
  36. return {};
  37. },
  38. methods: {
  39. handleLoading(index) {
  40. const Loading = this.$baseLoading(index);
  41. setTimeout(() => {
  42. Loading.close();
  43. }, 3000);
  44. },
  45. handleColorfullLoading(index) {
  46. const Loading = this.$baseColorfullLoading(index);
  47. setTimeout(() => {
  48. Loading.close();
  49. }, 3000);
  50. },
  51. },
  52. };
  53. </script>
  54. <style lang="scss" scoped>
  55. .loading-container {
  56. ::v-deep {
  57. .el-button {
  58. margin-top: 10px;
  59. margin-right: 10px;
  60. margin-left: 0;
  61. }
  62. .el-button + .el-button {
  63. margin-right: 10px;
  64. margin-left: 0;
  65. }
  66. }
  67. }
  68. </style>