From 1f693eb64b5151805c69ddd1ea0c9ffaa604f992 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Tue, 12 Nov 2024 16:28:18 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=AE=BE=E7=BD=AE=E5=A4=96?=
=?UTF-8?q?=E8=BE=B9=E8=B7=9D=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/common/div-content/index.vue | 6 ++++--
src/components/model-custom/index.vue | 20 ++++++++-----------
src/components/model-data-magic/index.vue | 12 +++++++----
.../model-search/model-search-styles.vue | 2 +-
src/views/layout/components/main/index.vue | 19 ++++++++++++------
5 files changed, 34 insertions(+), 25 deletions(-)
diff --git a/src/components/common/div-content/index.vue b/src/components/common/div-content/index.vue
index 4cf66ee7..6dc8f90a 100644
--- a/src/components/common/div-content/index.vue
+++ b/src/components/common/div-content/index.vue
@@ -74,7 +74,7 @@
-
+
@@ -82,7 +82,7 @@
-
+
@@ -122,6 +122,7 @@ interface Props {
showModelBorder: boolean;
isTabs?: boolean;
mainContentStyle: string;
+ outerContainerPadding: number;
}
const props = withDefaults(defineProps(), {
@@ -129,6 +130,7 @@ const props = withDefaults(defineProps(), {
showModelBorder: false,
isTabs: false,
mainContentStyle: '',
+ outerContainerPadding: 0,
});
const diy_data = ref(props.diyData);
diff --git a/src/components/model-custom/index.vue b/src/components/model-custom/index.vue
index 2b12bb97..508f1fbb 100644
--- a/src/components/model-custom/index.vue
+++ b/src/components/model-custom/index.vue
@@ -32,6 +32,10 @@ const props = defineProps({
default: () => {
return {};
},
+ },
+ outerContainerPadding: {
+ type: Number,
+ default: 0,
}
});
// 用于页面判断显示
@@ -45,27 +49,19 @@ const { form, new_style } = toRefs(state);
const custom_height = computed(() => form.value.height * scale.value + 'px');
const div_width = ref(0);
const scale = ref(1);
-// 获取当前宽度 和 缩放比例
-onMounted(() => {
- const { margin_left, margin_right, padding_left, padding_right } = new_style.value.common_style;
- // 根据容器宽度来计算内部大小
- div_width.value = 390 - margin_left - margin_right - padding_left - padding_right;
- // 获得对应宽度的比例
- scale.value = div_width.value / 390;
-});
const percentage_count = (val: number, container_size: number) => {
return val * scale.value + 'px';
};
// 公共样式
const style_container = computed(() => common_styles_computer(new_style.value.common_style));
const style_img_container = computed(() => common_img_computer(new_style.value.common_style));
-watch(() => new_style.value.common_style, (val) => {
- const { margin_left, margin_right, padding_left, padding_right } = val;
+watchEffect(() => {
+ const { margin_left, margin_right, padding_left, padding_right } = new_style.value.common_style;
// 根据容器宽度来计算内部大小
- div_width.value = 390 - margin_left - margin_right - padding_left - padding_right;
+ div_width.value = 390 - margin_left - margin_right - padding_left - padding_right - props.outerContainerPadding;
// 获得对应宽度的比例
scale.value = div_width.value / 390;
-}, { deep: true });
+});