修改比例处理

v1.2.0
于肖磊 2025-01-06 18:51:41 +08:00
parent f3923f7466
commit 94c1efaf07
4 changed files with 14 additions and 14 deletions

View File

@ -153,7 +153,8 @@ watchEffect(() => {
//
const new_width = old_width - outer_spacing - internal_spacing - content_spacing - data_spacing;
//
custom_scale.value = new_width / props.dataWidth;
const scale_number = new_width / props.dataWidth;
custom_scale.value = scale_number > 0 ? scale_number : 0;
});
//#endregion
//

View File

@ -76,7 +76,7 @@ const state = reactive({
// 使toRefs
const { form, new_style } = toRefs(state);
// ,
provide('field_list', computed(() => form.value.field_list));
provide('field_list', computed(() => form.value?.field_list || []));
onBeforeMount(() => {
//
if (!Object.keys(form.value.data_source_content).includes('data_auto_list') && !Object.keys(form.value.data_source_content).includes('data_list')) {
@ -110,7 +110,8 @@ watchEffect(() => {
//
const width = 390 - outer_spacing - internal_spacing - content_spacing - data_spacing - props.outerContainerPadding;
//
scale.value = width / 390;
const scale_number = width / 390;
scale.value = scale_number > 0 ? scale_number : 0;
});
//#endregion
//
@ -176,12 +177,11 @@ watchEffect(() => {
if (!isEmpty(data_source_content_list.value)) {
num = new_style.value.rolling_fashion == 'translation' ? data_source_content_list.value.length : Math.ceil(data_source_content_list.value.length / Number(data_source_carousel_col));
}
const { padding_top, padding_bottom, margin_bottom, margin_top } = new_style.value.data_style;
//
if (form.value.data_source_direction == 'horizontal') {
swiper_height.value = form.value.height * scale.value + padding_top + padding_bottom + margin_bottom + margin_top;
swiper_height.value = form.value.height * scale.value;
} else {
swiper_height.value = (form.value.height * scale.value + padding_top + padding_bottom + margin_bottom + margin_top) * col + ((data_source_carousel_col - 1) * space_between.value);
swiper_height.value = (form.value.height * scale.value) * col + ((data_source_carousel_col - 1) * space_between.value);
}
dot_list.value = Array(num);
// key

View File

@ -176,7 +176,8 @@ watchEffect(() => {
const data_spacing = ['vertical', 'horizontal'].includes(form.value.data_source_direction) ? new_style.value.column_gap * (form.value.data_source_carousel_col - 1) : 0;
// padding
const width = old_width - data_style - content_spacing - common_styles - data_spacing - (props.dataSpacing / 2);
scale.value = width / form.value.width;
const scale_number = width / form.value.width;
scale.value = scale_number > 0 ? scale_number : 0;
})
//
@ -216,13 +217,11 @@ watchEffect(() => {
const col = data_source_content_list.value.length > carousel_col ? carousel_col : data_source_content_list.value.length;
//
slides_per_view.value = col;
const { margin_bottom, margin_top } = new_style.value.data_chunk_margin;
const { padding_top, padding_bottom } = new_style.value.data_chunk_padding;
//
if (form.value.data_source_direction == '2') {
swiper_height.value = form.value.height * scale.value + padding_top + padding_bottom + margin_bottom + margin_top;
swiper_height.value = form.value.height * scale.value;
} else {
swiper_height.value = (form.value.height * scale.value + padding_top + padding_bottom + margin_bottom + margin_top) * col + ((carousel_col - 1) * space_between.value);
swiper_height.value = (form.value.height * scale.value) * col + ((carousel_col - 1) * space_between.value);
}
// key
carouselKey.value = get_math();

View File

@ -340,12 +340,12 @@ export const custom_condition_data = (data_source_id: string, option: any, sourc
*/
const data_handling = (data_source_id: string, sourceList: any, isCustom: boolean) => {
// 不输入商品, 文章和品牌时,从外层处理数据
let icon = get_nested_property(sourceList, data_source_id);
let new_data = get_nested_property(sourceList, data_source_id);
// 如果是商品,品牌,文章的图片, 其他的切换为从data中取数据
if (!isEmpty(sourceList.data) && isCustom) {
icon = get_nested_property(sourceList.data, data_source_id);
new_data = get_nested_property(sourceList.data, data_source_id);
}
return icon;
return new_data;
}
/**