Files
aurora-admin/site/sources/progressvariants/vue3.txt
T
aurora-admin c65a69c34e
Deploy to GitHub Pages / deploy (push) Failing after 16s
Regression / regression (push) Failing after 15m2s
feat(P4): precompute移植+app.js sources双向回填+回归1003/1003+验收体积/文件/data.json
2026-09-12 14:18:41 +08:00

37 lines
1.8 KiB
Plaintext

<template>
<div>
<div v-if="type === 'line'" class="aa-progress" :class="'is-' + status">
<div class="aa-progress-line-wrap">
<div class="aa-progress-line"><div class="aa-progress-line-fill" :style="{ width: percent + '%' }"></div></div>
<span v-if="showInfo" class="aa-progress-text">{{ status === 'success' ? '完成' : percent + '%' }}</span>
</div>
</div>
<div v-else class="aa-progress-circle" :class="status !== 'normal' ? 'is-' + status : ''">
<svg width="100" height="100" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="42" fill="none" stroke="#E8ECF1" stroke-width="8"
:stroke-dasharray="circleCirc" :stroke-dashoffset="type === 'dashboard' ? circleCirc * 0.25 : 0" />
<circle cx="50" cy="50" r="42" fill="none" :stroke="color" stroke-width="8" stroke-linecap="round"
:stroke-dasharray="arcLen" :stroke-dashoffset="arcLen * (1 - percent / 100)"
:transform="type === 'dashboard' ? 'rotate(135 50 50)' : 'rotate(-90 50 50)'" />
</svg>
<span v-if="showInfo" class="aa-progress-circle-text">{{ percent }}%</span>
</div>
</div>
</template>
<script setup>
import { computed } from 'vue';
const props = defineProps({
type: { type: String, default: 'line' },
percent: { type: Number, default: 0 },
status: { type: String, default: 'normal' },
showInfo: { type: Boolean, default: true }
});
const r = 42;
const circleCirc = computed(() => 2 * Math.PI * r);
const arcLen = computed(() => props.type === 'dashboard' ? circleCirc.value * 0.75 : circleCirc.value);
const color = computed(() => ({ success: '#2E7D0A', warning: '#8C5A00', error: '#CF1322', normal: '#2F54EB' })[props.status] || '#2F54EB');
</script>
<style src="./ProgressVariants.css"></style>