内边距,外边距,圆角设置默认数据不一致时展开

v1.1.0
于肖磊 2024-11-04 18:21:22 +08:00
parent 02ad8671df
commit bbfe5829ed
4 changed files with 38 additions and 0 deletions

View File

@ -25,6 +25,7 @@
</div>
</template>
<script setup lang="ts">
import { areAllEqual } from '@/utils';
const props = defineProps({
value: {
type: Object,
@ -69,6 +70,13 @@ const pr_event = (val: number | undefined) => {
emit('update:value', form);
};
//#region
onBeforeMount(() => {
//
const flag = areAllEqual(form.value.margin_top, form.value.margin_bottom, form.value.margin_left, form.value.margin_right);
if (!flag) {
icon_event('unified');
}
});
const icon_data = reactive({
name: 'unified',
title: '统一'

View File

@ -25,6 +25,7 @@
</div>
</template>
<script setup lang="ts">
import { areAllEqual } from '@/utils';
const props = defineProps({
value: {
type: Object,
@ -69,6 +70,13 @@ const pr_event = (val: number | undefined) => {
emit('update:value', form);
};
//#region
onBeforeMount(() => {
//
const flag = areAllEqual(form.value.padding_top, form.value.padding_bottom, form.value.padding_left, form.value.padding_right);
if (!flag) {
icon_event('unified');
}
});
const icon_data = reactive({
name: 'unified',
title: '统一'

View File

@ -26,6 +26,8 @@
</div>
</template>
<script setup lang="ts">
import { areAllEqual } from '@/utils';
//
// interface common_radius {
// radius: number;
// radius_top_left: number;
@ -86,6 +88,13 @@ const rbr_event = (val: number | undefined) => {
emit('update:value', form.value);
};
//#region
onBeforeMount(() => {
//
const flag = areAllEqual(form.value.radius_top_left, form.value.radius_top_right, form.value.radius_bottom_left, form.value.radius_bottom_right);
if (!flag) {
icon_event('unified');
}
});
const icon_data = reactive({
name: 'unified',
title: '统一'

View File

@ -319,6 +319,19 @@ export const percentage_count = (num: number, container_size: number) => {
return marks.toFixed(4) + '%';
};
/**
*
*
* @param a,b,c,d
* @returns boolean truefalse
*/
export const areAllEqual = (a: number, b: number, c: number, d: number) => {
if (a === null || a === undefined || b === null || b === undefined || c === null || c === undefined || d === null || d === undefined) {
return false;
}
return a === b && b === c && c === d;
}
/**
*
*