Files
lgp-wx-plus/components/theme/ThemeSpinner.vue
2026-08-19 08:17:18 +08:00

59 lines
1.2 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<!-- 触底/阻断加载圈:颜色跟主题主色 -->
<view class="spin-wrap">
<view class="spin" :style="spinStyle" />
<text v-if="text" class="spin-txt" :style="{ color: soft }">{{ text }}</text>
</view>
</template>
<script>
import { getActiveVars } from '@/utils/theme'
export default {
name: 'ThemeSpinner',
props: {
text: { type: String, default: '加载中' },
},
computed: {
vars() {
return getActiveVars()
},
soft() {
return this.vars['--color-text-soft'] || '#78716C'
},
spinStyle() {
const primary = this.vars['--color-primary'] || '#B08D57'
const border = this.vars['--color-border'] || '#E7DFD3'
return {
borderColor: border,
borderTopColor: primary,
}
},
},
}
</script>
<style lang="scss" scoped>
.spin-wrap {
display: flex;
flex-direction: column;
align-items: center;
padding: 24rpx 0;
}
.spin {
width: 40rpx;
height: 40rpx;
border-width: 4rpx;
border-style: solid;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
.spin-txt {
margin-top: 8rpx;
font-size: 22rpx;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>