add margin attr for Loading component

This commit is contained in:
Timi
2025-07-12 00:59:39 +08:00
parent 7fa6bdbb95
commit 9ca80322d0

View File

@ -24,14 +24,16 @@ const props = withDefaults(defineProps<{
showOn?: boolean;
size?: number;
filled?: boolean;
margin?: string | number;
}>(), {
tips: "加载中..",
delay: 260,
showOn: true,
size: 24,
filled: false
filled: false,
margin: 0
});
const { tips, delay, showOn, size, filled } = toRefs(props);
const { tips, delay, showOn, size, filled, margin } = toRefs(props);
// ---------- 尺寸参数 ----------
@ -40,10 +42,12 @@ const style = computed(() => {
const height = Math.round(base);
const width = Math.round(base * (8 / 24));
const gap = Math.round(base * (3 / 24));
const marginValue = typeof margin.value === "string" ? margin.value : `${margin.value}px`;
return {
"--loading-height": `${height}px`,
"--rect-width": `${width}px`,
"--rect-gap": `${gap}px`
"--rect-gap": `${gap}px`,
"margin": marginValue
};
});