myLoading.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view class="loading_box" v-show="is_loading" @click="switch_loading">
  3. <view class="loading">
  4. <view class="loader loader-17">
  5. <view v-for="(item,index) in 9" :key="index" :class="'css-square '+`square`+(index+1)"></view>
  6. </view>
  7. <!-- <view class="loader loader-4"></view> -->
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. };
  16. },
  17. methods:{
  18. switch_loading(){
  19. this.$store.commit("switch_loading")
  20. }
  21. },
  22. computed:{
  23. is_loading(){
  24. return this.$store.state.loading.loading
  25. }
  26. }
  27. }
  28. </script>
  29. <style>
  30. @import "./loading.css";
  31. .loading_box{
  32. width: 100%;
  33. height: 100%;
  34. /* background-color: rgba(0,0,0,0.4); */
  35. position: absolute;
  36. left: 0;
  37. top: 0;
  38. z-index: 10000;
  39. }
  40. .loading{
  41. width: 250upx;
  42. height: 200upx;
  43. background-color: rgba(0,0,0,0.5);
  44. color: #fff;
  45. position: relative;
  46. top: 50%;
  47. left: 50%;
  48. transform: translate(-50%,-50%);
  49. border-radius: 20upx;
  50. }
  51. .loader{
  52. display:inline-block;
  53. width:100%;
  54. height:200upx;
  55. overflow:hidden;
  56. /* background-color:#ccc; */
  57. position:relative;
  58. }
  59. </style>