index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div class="cip-cancel-loading" v-if="visible">
  3. <div class="cip-cancel-loading__mark"></div>
  4. <div class="cip-cancel-loading__dialog">
  5. <div class="cip-cancel-loading__content">
  6. <slot name="content">
  7. <i class="el-icon-loading"></i>
  8. <div class="cip-cancel-loading__text" v-html="message"></div>
  9. </slot>
  10. </div>
  11. <div class="cip-cancel-loading__button" @click="close">{{btnName}}</div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import { defineComponent, ref } from 'vue'
  17. import { generateProps } from '../helper/component-util'
  18. import { componentScheme } from './component.scheme'
  19. // 组件介绍:本组件是可关闭的loading加载组件,一般适用于耗时比较长接口连接调用
  20. export default defineComponent({
  21. name: 'CipCancelLoading',
  22. props: generateProps(componentScheme),
  23. emits: ['vanish'],
  24. setup (props, { emit }) {
  25. const visible = ref(false)
  26. const close = () => {
  27. visible.value = false
  28. emit('vanish')
  29. }
  30. return {
  31. visible,
  32. close
  33. }
  34. }
  35. })
  36. </script>
  37. <style lang="less">
  38. .cip-cancel-loading{
  39. &__dialog {
  40. top: 50%;
  41. left: 50%;
  42. opacity: 1;
  43. position: fixed;
  44. transform: translate(-50%, -50%);
  45. color: #000;
  46. z-index: 99999;
  47. }
  48. &__mark {
  49. top: 0;
  50. left: 0;
  51. width: 100%;
  52. height: 100%;
  53. opacity: 0.3;
  54. display: block;
  55. position: fixed;
  56. z-index: 9999;
  57. background-color: #000;
  58. }
  59. &__content {
  60. text-align: center;
  61. }
  62. &__text {
  63. font-size: 16px;
  64. text-align: center;
  65. }
  66. &__button {
  67. color: #000;
  68. border-radius: 4px;
  69. border: 1px solid #000;
  70. padding: 10px 30px;
  71. font-size: 15px;
  72. text-align: center;
  73. margin-top: 10px;
  74. cursor: pointer;
  75. width: 140px;
  76. }
  77. .@{elNamespace}-icon-loading {
  78. font-size: 100px;
  79. }
  80. }
  81. </style>