pageLoading.vue 792 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <van-overlay :show="pageLoadingVisible"
  3. style="background-color: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center;">
  4. <van-loading size="48px" vertical type="spinner" color="#fff">{{ laodingText }}</van-loading>
  5. </van-overlay>
  6. </template>
  7. <script>
  8. import { Overlay, Loading } from 'vant'
  9. export default {
  10. components: {
  11. [Overlay.name]: Overlay,
  12. [Loading.name]: Loading
  13. },
  14. data() {
  15. return {
  16. pageLoadingVisible: false,
  17. laodingText: '加载中'
  18. }
  19. },
  20. methods: {
  21. showPageLoading(laodingText) {
  22. this.pageLoadingVisible = true
  23. this.laodingText = laodingText || '加载中'
  24. },
  25. cloasePageLoading() {
  26. this.pageLoadingVisible = false
  27. }
  28. },
  29. }
  30. </script>
  31. <style scoped></style>