|
@@ -0,0 +1,61 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="x-loading">
|
|
3
|
+ <div v-show="show" class="loadding-wrapper">
|
|
4
|
+ <div class="loading-flex">
|
|
5
|
+ <div style="flex:none">
|
|
6
|
+ <van-loading :color="color || '#1989fa'">{{tip}}</van-loading>
|
|
7
|
+ </div>
|
|
8
|
+ </div>
|
|
9
|
+ </div>
|
|
10
|
+ <slot></slot>
|
|
11
|
+ </div>
|
|
12
|
+</template>
|
|
13
|
+
|
|
14
|
+<script>
|
|
15
|
+import { computed } from 'vue'
|
|
16
|
+import { Loading } from 'vant'
|
|
17
|
+import { useModel } from '@zjxpcyc/vue-tiny-store'
|
|
18
|
+// import store from '../../store'
|
|
19
|
+
|
|
20
|
+export default {
|
|
21
|
+ components: {
|
|
22
|
+ [Loading.name]: Loading,
|
|
23
|
+ },
|
|
24
|
+ props: {
|
|
25
|
+ color: String,
|
|
26
|
+ tip: String,
|
|
27
|
+ xId: String,
|
|
28
|
+ },
|
|
29
|
+ setup(props) {
|
|
30
|
+ const { loading } = useModel('loading')
|
|
31
|
+
|
|
32
|
+ const show = computed(() => loading[props.xId])
|
|
33
|
+
|
|
34
|
+ return {
|
|
35
|
+ show
|
|
36
|
+ }
|
|
37
|
+ }
|
|
38
|
+}
|
|
39
|
+</script>
|
|
40
|
+
|
|
41
|
+<style lang="less" scoped>
|
|
42
|
+.x-loading {
|
|
43
|
+ position: relative;
|
|
44
|
+
|
|
45
|
+ .loadding-wrapper {
|
|
46
|
+ width: 100%;
|
|
47
|
+ height: 100%;
|
|
48
|
+ background: rgba(255, 255, 255, .9);
|
|
49
|
+ z-index: 9999;
|
|
50
|
+ position: absolute;
|
|
51
|
+ top: 0;
|
|
52
|
+ left: 0;
|
|
53
|
+
|
|
54
|
+ .loading-flex {
|
|
55
|
+ display: flex;
|
|
56
|
+ justify-content: center;
|
|
57
|
+ align-items: center;
|
|
58
|
+ }
|
|
59
|
+ }
|
|
60
|
+}
|
|
61
|
+</style>
|