diff --git a/src/components/Loading.vue b/src/components/Loading.vue index b7afc60..6e77dc1 100644 --- a/src/components/Loading.vue +++ b/src/components/Loading.vue @@ -1,82 +1,31 @@ @@ -117,36 +66,17 @@ const containerStyle = computed(() => { if (props.fullscreen) { style.background = props.background || - 'radial-gradient(circle at 20% 20%, rgba(255,247,249,0.95), rgba(255,236,240,0.72))' + 'radial-gradient(circle at 20% 20%, rgba(255,247,249,0.75), rgba(255,236,240,0.72))' style.opacity = props.opacity ?? 1 } return style }) -// 计算spinner包装器样式 -const spinnerWrapperStyle = computed(() => { - const color = props.color || '#E8424D' - return { - color, - '--loading-color': color - } -}) - -// 计算spinner样式 -const spinnerStyle = computed(() => { - return { - width: typeof props.size === 'number' ? `${props.size}px` : props.size || '40px', - height: typeof props.size === 'number' ? `${props.size}px` : props.size || '40px' - } -}) - -// 计算svg样式 -const svgStyle = computed(() => { - return { - animationDuration: '1.4s', - transformOrigin: 'center center' - } -}) +const spinnerStyle = computed(() => ({ + width: typeof props.size === 'number' ? `${props.size}px` : props.size || '44px', + height: typeof props.size === 'number' ? `${props.size}px` : props.size || '44px', + color: props.color || '#fff' +})) // 计算线条宽度 const strokeWidth = computed(() => { @@ -158,230 +88,86 @@ const strokeLinecap = computed(() => { return props.strokeLinecap || 'round' }) -// 计算点状加载容器样式 -const dotsContainerStyle = computed(() => { - return { - gap: typeof props.size === 'number' ? `${props.size / 6}px` : '6px' - } -}) - -// 计算点状加载样式 -const dotStyle = computed(() => { - const dotSize = typeof props.size === 'number' ? props.size / 5 : 8 - return { - width: `${dotSize}px`, - height: `${dotSize}px`, - backgroundColor: props.color || '#1890ff' - } -}) - -// 计算脉冲样式 -const pulseStyle = computed(() => { - const pulseSize = typeof props.size === 'number' ? props.size : 40 - return { - width: `${pulseSize}px`, - height: `${pulseSize}px`, - backgroundColor: props.color || '#1890ff' - } -}) - -// 计算环形样式 -const ringStyle = computed(() => { - const ringSize = typeof props.size === 'number' ? props.size : 40 - return { - width: `${ringSize}px`, - height: `${ringSize}px` - } -}) - -// 计算环形内部圆样式 -const ringCircleStyle = computed(() => { - const circleBorderWidth = props.strokeWidth || 3 - return { - borderWidth: `${circleBorderWidth}px`, - borderColor: `${props.color || '#1890ff'} transparent ${props.color || '#1890ff'} transparent` - } -}) - // 计算文本样式 const textStyle = computed(() => { return { - marginTop: typeof props.size === 'number' ? `${props.size / 4}px` : '10px', - color: props.color || '#666' + marginTop: '12px', + color: '#fff' } }) diff --git a/src/components/loading.ts b/src/components/loading.ts index d22218d..5108354 100644 --- a/src/components/loading.ts +++ b/src/components/loading.ts @@ -48,12 +48,12 @@ export function showLoading(options: LoadingOptions = {}): LoadingInstance { const defaultOptions: LoadingOptions = { type: 'spinner', size: 42, - color: '#E8424D', + color: '#ffffff', fullscreen: true, text: '', - background: 'rgba(255, 241, 243, 0.8)', - opacity: 1, - strokeWidth: 3, + background: 'rgba(0, 0, 0, 0.28)', + opacity: 0.7, + strokeWidth: 4, strokeLinecap: 'round' }