add margin attr for Loading component
This commit is contained in:
@ -24,14 +24,16 @@ const props = withDefaults(defineProps<{
|
|||||||
showOn?: boolean;
|
showOn?: boolean;
|
||||||
size?: number;
|
size?: number;
|
||||||
filled?: boolean;
|
filled?: boolean;
|
||||||
|
margin?: string | number;
|
||||||
}>(), {
|
}>(), {
|
||||||
tips: "加载中..",
|
tips: "加载中..",
|
||||||
delay: 260,
|
delay: 260,
|
||||||
showOn: true,
|
showOn: true,
|
||||||
size: 24,
|
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 height = Math.round(base);
|
||||||
const width = Math.round(base * (8 / 24));
|
const width = Math.round(base * (8 / 24));
|
||||||
const gap = Math.round(base * (3 / 24));
|
const gap = Math.round(base * (3 / 24));
|
||||||
|
const marginValue = typeof margin.value === "string" ? margin.value : `${margin.value}px`;
|
||||||
return {
|
return {
|
||||||
"--loading-height": `${height}px`,
|
"--loading-height": `${height}px`,
|
||||||
"--rect-width": `${width}px`,
|
"--rect-width": `${width}px`,
|
||||||
"--rect-gap": `${gap}px`
|
"--rect-gap": `${gap}px`,
|
||||||
|
"margin": marginValue
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user