1.自定义优化

v1.0.0
sws 2024-10-21 18:39:13 +08:00
parent d15fc355d2
commit 2d973d5fc7
1 changed files with 9 additions and 14 deletions

View File

@ -8,37 +8,32 @@ const props = defineProps({
default: () => {
return {};
},
required: true
required: true,
},
isPercentage: {
type: Boolean,
default: false
default: false,
},
scale: {
type: Number,
default: 1
}
default: 1,
},
});
//
const form = reactive(props.value);
const border_style = computed(() => {
if (form.line_settings === 'horizontal') {
return `${ set_count() } margin: 5px 0;border-bottom: ${form.line_size * props.scale }px ${form.line_style} ${form.line_color};`;
return `${set_count()} margin: 5px 0;border-bottom: ${form.line_size * props.scale}px ${form.line_style} ${form.line_color};`;
} else {
return `${ set_count() } margin: 0 5px;border-right: ${form.line_size * props.scale }px ${form.line_style} ${form.line_color};`;
return `${set_count()} margin: 0 5px;border-right: ${form.line_size * props.scale}px ${form.line_style} ${form.line_color};`;
}
});
const set_count = () => {
if (props.isPercentage) {
return '';
if (form.line_settings === 'horizontal') {
return `width: ${form.com_width}px;`;
} else {
if (form.line_settings === 'horizontal') {
return `width: ${ form.com_width }px;`;
} else {
return `height: ${ form.com_height }px;`;
}
return `height: ${form.com_height}px;`;
}
};
</script>