1 | <template>
|
2 | <transition name="mint-indicator">
|
3 | <div class="mint-indicator" v-show="visible">
|
4 | <div class="mint-indicator-wrapper" :style="{ 'padding': text ? '20px' : '15px' }">
|
5 | <spinner class="mint-indicator-spin" :type="convertedSpinnerType" :size="32"></spinner>
|
6 | <span class="mint-indicator-text" v-show="text">{{ text }}</span>
|
7 | </div>
|
8 | <div class="mint-indicator-mask" @touchmove.stop.prevent></div>
|
9 | </div>
|
10 | </transition>
|
11 | </template>
|
12 |
|
13 | <style>
|
14 | @component-namespace mint {
|
15 | @component indicator {
|
16 | transition: opacity .2s linear;
|
17 |
|
18 | @descendent wrapper {
|
19 | position: fixed 50% * * 50%;
|
20 | transform: translate(-50%, -50%);
|
21 | border-radius: 5px;
|
22 | background: rgba(0, 0, 0, 0.7);
|
23 | color: white;
|
24 | box-sizing: border-box;
|
25 | text-align: center;
|
26 | }
|
27 |
|
28 | @descendent text {
|
29 | display: block;
|
30 | color: #fff;
|
31 | text-align: center;
|
32 | margin-top: 10px;
|
33 | font-size: 16px;
|
34 | }
|
35 |
|
36 | @descendent spin {
|
37 | display: inline-block;
|
38 | text-align: center;
|
39 | }
|
40 |
|
41 | @descendent mask {
|
42 | position: fixed 0 * * 0;
|
43 | size: 100%;
|
44 | opacity: 0;
|
45 | background: transparent;
|
46 | }
|
47 | }
|
48 | }
|
49 |
|
50 | .mint-indicator-enter,
|
51 | .mint-indicator-leave-active {
|
52 | opacity: 0;
|
53 | }
|
54 | </style>
|
55 |
|
56 | <script type="text/babel">
|
57 | import Spinner from 'mint-ui/packages/spinner/index.js';
|
58 | if (process.env.NODE_ENV === 'component') {
|
59 | require('mint-ui/packages/spinner/style.css');
|
60 | }
|
61 |
|
62 | export default {
|
63 | data() {
|
64 | return {
|
65 | visible: false
|
66 | };
|
67 | },
|
68 |
|
69 | components: {
|
70 | Spinner
|
71 | },
|
72 |
|
73 | computed: {
|
74 | convertedSpinnerType() {
|
75 | switch (this.spinnerType) {
|
76 | case 'double-bounce':
|
77 | return 1;
|
78 | case 'triple-bounce':
|
79 | return 2;
|
80 | case 'fading-circle':
|
81 | return 3;
|
82 | default:
|
83 | return 0;
|
84 | }
|
85 | }
|
86 | },
|
87 |
|
88 | props: {
|
89 | text: String,
|
90 | spinnerType: {
|
91 | type: String,
|
92 | default: 'snake'
|
93 | }
|
94 | }
|
95 | };
|
96 | </script>
|