Blame view

components/thorui/tui-loading/tui-loading.vue 4.98 KB
46b6767c   刘淇   init 提交到库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
  <template>
  	<view>
  		<view class="tui-loading tui-loading__box" :class="{'tui-loading__fixed':fixed}"
  			:style="{ backgroundColor: backgroundColor, color: color,position:fixed?'fixed':'static' }"
  			v-if="type === 'column'">
  			<image class="tui-loading__ani" :src="src"></image>
  			<view class="tui-loading__text">{{ text }}</view>
  		</view>
  		<view v-else class="tui-loading tui-loading__row" :class="{'tui-loading__fixed':fixed}"
  			:style="{position:fixed?'fixed':'static'}">
  			<image class="tui-loading-row__ani" :src="rowsrc"></image>
  			<view class="tui-loading__text">{{ text }}</view>
  		</view>
  		<view class="tui-loading__mask" :style="{background:maskColor}" v-if="isMask && fixed"></view>
  	</view>
  </template>
  
  <script>
  	export default {
  		name: 'tuiLoading',
  		props: {
  			//column or row
  			type: {
  				type: String,
  				default: 'column'
  			},
  			text: {
  				type: String,
  				default: '加载中'
  			},
  			//type=column时生效
  			color: {
  				type: String,
  				default: '#fff'
  			},
  			//type=column时生效
  			backgroundColor: {
  				type: String,
  				default: 'rgba(0, 0, 0, 0.6)'
  			},
  			//type=column时生效
  			src: {
  				type: String,
  				default: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAARVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////9SnXPCAAAAFnRSTlMA8ECgECCAYDDQ4M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ojorfzsty9v8y2n/DTZgBKZLueInZAjR7CkWoYDLBgXCvSs/uoyoJ3Y3zWjOPg4T14KQf7m0FKqeHi4uJH+QUYYoTOYC/s2wAAAABJRU5ErkJggg=='
  			},
  			//type=row时生效
  			rowsrc: {
  				type: String,
  				default: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAMAAAAPdrEwAAAAM1BMVEUAAACPj4+IiIiIiIiIiIiIiIiKioqHh4eHh4eHh4eHh4eIiIiIiIiJiYmIiIiJiYmIiIi8awvKAAAAEHRSTlMAEEDw4NAwwKAgYICQULBwL0wVnQAAAmpJREFUWMPtmOmO4yAQhLlvMO//tDuyjfAaCEcj7UqTT5o/iafSVLcLY/TldyHID8fPH94oir2TLD6QyugdxVoeazAnYPUaFtsws+yNVjR+htolcWz/luHyhL7F55XNQ0Narx+L8TY8bSGTXsiYUB5V8A+zHJ4rud+p3GI+PiwqCXv0Ec+T42awf3L8+iMtzwwp36UEPHR1SIYPKueS+xxJe1CZiYkooNmTvjLHUzHDR7TVgnI2UXR9k/OhQHslieKCcb87reRnB5fCzMeTVp5cUbeY8O6arEYknYs60CJXK21zOvot7DSK4lrR51eA7dQ1y1bFF9MT2Chb358DsLHeLJeKhpZdDgkDFp1jQtRGXiEYOtZU1PLdUt7OFT84gnJUHNE5XOCO2PLnCALDzl21HD2Yam4ZRU9kER8Qs/V7IQ7BIWVqp10TTCFN0gdgwvumJmkcwWDFgigsQtv4Sv8baZ2lt5Pn+n+Wfm+CMsUsHFIJQ7VH+l2hSXsaHFUbEb1l2GRt5zFb/FC1nSfskGam+lSP4cqmks10jyOc1fditiGMXD1G4DekTH5sf14gkTeD1QOdbrRLXodGAKb1hC7gh5nmvzvgI0NoHyswA1niP7WKQE4dmtYHDH4MwzxS3T2MmCWje5OL2aK26j9EC7qkrVIk97XtrM+RYzSoHSZmUCTlLoLNvTs+aFLug+XEu2Mt59boRl9+4vk7gbD79fXnii2dsS6Xc4lb3fx5lX1bfKfPD1HJInetS64lJQnxhkrryV2+INbxeCHXN1PtaGxClUYgvGJ1XY82IA7Fn7IyFO7DIDcYfflN/AFNdjdeDj7M+wAAAABJRU5ErkJggg=='
  			},
  			fixed: {
  				type: Boolean,
  				default: true
  			},
  			//v2.9.0+
  			isMask: {
  				type: Boolean,
  				default: false
  			},
  			//v2.9.0+
  			maskColor: {
  				type: String,
  				default: 'rgba(0,0,0,.3)'
  			}
  		}
  	};
  </script>
  
  <style scoped>
  	.tui-loading {
  		display: flex;
  		align-items: center;
  		justify-content: center;
  	}
  
  	.tui-loading__fixed {
  		top: 50%;
  		left: 50%;
  		transform: translate(-50%, -50%);
  		z-index: 9999;
  	}
  
  	.tui-loading__mask {
  		width: 100%;
  		position: fixed;
  		top: 0;
  		left: 0;
  		right: 0;
  		bottom: 0;
  		z-index: 9900;
  	}
  
  	.tui-loading__box {
  		min-width: 200rpx;
  		min-height: 200rpx;
  		max-width: 500rpx;
  		flex-direction: column;
  		border-radius: 10rpx;
  	}
  
  	.tui-loading__ani {
  		width: 64rpx;
  		height: 64rpx;
  		margin: 0 6px;
  		animation: rotate 0.9s linear infinite;
  		margin-bottom: 30rpx;
  	}
  
  	.tui-loading__row {
  		width: 100%;
  		height: 36rpx;
  		color: #888;
  	}
  
  	.tui-loading-row__ani {
  		width: 36rpx;
  		height: 36rpx;
  		display: block;
  		border-radius: 50%;
  		animation: rotate 0.9s linear infinite;
  		margin-right: 20rpx;
  	}
  
  	.tui-loading__text {
  		font-size: 26rpx;
  		line-height: 26rpx;
  		text-align: center;
  	}
  
  	@-webkit-keyframes rotate {
  		from {
  			transform: rotatez(0deg);
  		}
  
  		to {
  			transform: rotatez(360deg);
  		}
  	}
  
  	@keyframes rotate {
  		from {
  			transform: rotatez(0deg);
  		}
  
  		to {
  			transform: rotatez(360deg);
  		}
  	}
  </style>