内边距,外边距,圆角设置默认数据不一致时展开
parent
02ad8671df
commit
bbfe5829ed
|
|
@ -25,6 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { areAllEqual } from '@/utils';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -69,6 +70,13 @@ const pr_event = (val: number | undefined) => {
|
||||||
emit('update:value', form);
|
emit('update:value', form);
|
||||||
};
|
};
|
||||||
//#region 展开收起
|
//#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({
|
const icon_data = reactive({
|
||||||
name: 'unified',
|
name: 'unified',
|
||||||
title: '统一'
|
title: '统一'
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { areAllEqual } from '@/utils';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
value: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -69,6 +70,13 @@ const pr_event = (val: number | undefined) => {
|
||||||
emit('update:value', form);
|
emit('update:value', form);
|
||||||
};
|
};
|
||||||
//#region 展开收起
|
//#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({
|
const icon_data = reactive({
|
||||||
name: 'unified',
|
name: 'unified',
|
||||||
title: '统一'
|
title: '统一'
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { areAllEqual } from '@/utils';
|
||||||
|
// 通用样式
|
||||||
// interface common_radius {
|
// interface common_radius {
|
||||||
// radius: number;
|
// radius: number;
|
||||||
// radius_top_left: number;
|
// radius_top_left: number;
|
||||||
|
|
@ -86,6 +88,13 @@ const rbr_event = (val: number | undefined) => {
|
||||||
emit('update:value', form.value);
|
emit('update:value', form.value);
|
||||||
};
|
};
|
||||||
//#region 展开收起
|
//#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({
|
const icon_data = reactive({
|
||||||
name: 'unified',
|
name: 'unified',
|
||||||
title: '统一'
|
title: '统一'
|
||||||
|
|
|
||||||
|
|
@ -319,6 +319,19 @@ export const percentage_count = (num: number, container_size: number) => {
|
||||||
return marks.toFixed(4) + '%';
|
return marks.toFixed(4) + '%';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断四个值是否相等
|
||||||
|
*
|
||||||
|
* @param a,b,c,d 对应的四个数字
|
||||||
|
* @returns boolean true表示相等,false表示不相等
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算当前偏移量
|
* 计算当前偏移量
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue