2024-08-26 14:13:36 +08:00
|
|
|
<template>
|
|
|
|
|
<view>
|
2025-02-06 11:37:41 +08:00
|
|
|
<view class="spinner-box" :style="{ width: size + 'rpx', height: size + 'rpx' }">
|
|
|
|
|
<view
|
|
|
|
|
v-if="show"
|
|
|
|
|
class="circle-border"
|
|
|
|
|
:style="{ width: size * 0.75 + 'rpx', height: size * 0.75 + 'rpx' }"
|
|
|
|
|
>
|
2024-08-26 14:13:36 +08:00
|
|
|
</view>
|
2025-02-06 11:37:41 +08:00
|
|
|
<view
|
|
|
|
|
v-else
|
|
|
|
|
class="circle-border-stop"
|
|
|
|
|
:style="{ width: size * 0.75 + 'rpx', height: size * 0.75 + 'rpx' }"
|
|
|
|
|
></view>
|
|
|
|
|
<view
|
|
|
|
|
class="circle-core"
|
|
|
|
|
:style="{ width: size * 0.75 - 2 + 'rpx', height: size * 0.75 - 2 + 'rpx' }"
|
|
|
|
|
>
|
|
|
|
|
<image
|
|
|
|
|
src="/static/images/icon_lock_transparent.png"
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
:style="{ width: size * 0.35 + 'rpx', height: size * 0.35 + 'rpx' }"
|
|
|
|
|
></image>
|
2024-08-26 14:13:36 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-02-06 11:37:41 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'SwitchLoading',
|
|
|
|
|
props: {
|
|
|
|
|
size: Number
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
show: false
|
|
|
|
|
}
|
2024-08-26 14:13:36 +08:00
|
|
|
},
|
2025-02-06 11:37:41 +08:00
|
|
|
methods: {
|
|
|
|
|
open() {
|
|
|
|
|
this.show = true
|
|
|
|
|
},
|
|
|
|
|
close() {
|
|
|
|
|
this.show = false
|
|
|
|
|
}
|
2024-08-26 14:13:36 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
2025-02-06 11:37:41 +08:00
|
|
|
@keyframes spin {
|
|
|
|
|
from {
|
|
|
|
|
transform: rotate(0);
|
|
|
|
|
}
|
|
|
|
|
to {
|
|
|
|
|
transform: rotate(359deg);
|
|
|
|
|
}
|
2024-08-26 14:13:36 +08:00
|
|
|
}
|
|
|
|
|
|
2025-02-06 11:37:41 +08:00
|
|
|
.spinner-box {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
background-color: transparent;
|
2024-08-26 14:13:36 +08:00
|
|
|
|
2025-02-06 11:37:41 +08:00
|
|
|
position: relative;
|
|
|
|
|
}
|
2024-08-26 14:13:36 +08:00
|
|
|
|
2025-02-06 11:37:41 +08:00
|
|
|
.circle-border {
|
|
|
|
|
padding: 3upx;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background: rgb(99, 184, 175);
|
|
|
|
|
background: linear-gradient(0deg, rgba(99, 184, 175, 0.1) 33%, rgba(99, 184, 175, 1) 100%);
|
|
|
|
|
animation: spin 0.8s linear 0s infinite;
|
2024-08-26 14:13:36 +08:00
|
|
|
|
2025-02-06 11:37:41 +08:00
|
|
|
position: absolute;
|
|
|
|
|
z-index: 0;
|
|
|
|
|
}
|
2024-08-26 14:13:36 +08:00
|
|
|
|
2025-02-06 11:37:41 +08:00
|
|
|
.circle-border-stop {
|
|
|
|
|
padding: 3upx;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background: rgb(99, 184, 175);
|
|
|
|
|
position: absolute;
|
|
|
|
|
z-index: 0;
|
|
|
|
|
}
|
2024-08-26 14:13:36 +08:00
|
|
|
|
2025-02-06 11:37:41 +08:00
|
|
|
.circle-core {
|
|
|
|
|
z-index: 1;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background-color: #ffffff;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2024-08-26 14:13:36 +08:00
|
|
|
</style>
|