diff --git a/src/components/common/custom-module/model-text/index.vue b/src/components/common/custom-module/model-text/index.vue index 34239060..2d2f03b5 100644 --- a/src/components/common/custom-module/model-text/index.vue +++ b/src/components/common/custom-module/model-text/index.vue @@ -47,7 +47,7 @@ const text_title = computed(() => { }); const text_style = computed(() => { - let style = `font-size: ${ form.text_size }px;color: ${ form.text_color }; text-align: ${ form.text_location }; transform: rotate(${form.text_rotate}deg);text-decoration: ${ form.text_option };${ padding_computer(form.text_padding) };`; + let style = `font-size: ${ form.text_size }px;line-height: ${ form.text_size }px;color: ${ form.text_color }; text-align: ${ form.text_location }; transform: rotate(${form.text_rotate}deg);text-decoration: ${ form.text_option };${ padding_computer(form.text_padding) };`; if (form.text_weight == 'italic') { style += `font-style: italic`; } else if (form.text_weight == '500') { diff --git a/src/components/model-data-magic/components/magic-carousel.vue b/src/components/model-data-magic/components/magic-carousel.vue index b6d2b710..e3df2977 100644 --- a/src/components/model-data-magic/components/magic-carousel.vue +++ b/src/components/model-data-magic/components/magic-carousel.vue @@ -5,7 +5,7 @@ @@ -17,18 +17,19 @@ interface Props { contentImgRadius: string; type: string; actived: number; + goodStyle?: any; } -const props = defineProps(); +const props = withDefaults(defineProps(), { + goodStyle: {}, +}); + +const form = computed(() => props.value); -const form = ref(props.value); const emits = defineEmits(['carousel_change']); const carousel_change = (index: number) => { emits('carousel_change', index); }; -watchEffect(() => { - form.value = props.value; -}); \ No newline at end of file diff --git a/src/components/model-data-magic/components/tabs-styles.vue b/src/components/model-data-magic/components/tabs-styles.vue index cdad8d91..1a2af617 100644 --- a/src/components/model-data-magic/components/tabs-styles.vue +++ b/src/components/model-data-magic/components/tabs-styles.vue @@ -40,6 +40,16 @@
+ +
商品样式
+ + + + + + +
+
diff --git a/src/components/model-data-magic/index.vue b/src/components/model-data-magic/index.vue index 20bd246c..52c5207a 100644 --- a/src/components/model-data-magic/index.vue +++ b/src/components/model-data-magic/index.vue @@ -6,7 +6,7 @@
- + 黑色 白色 @@ -41,7 +41,7 @@
- +
背景图
@@ -106,6 +106,7 @@ const state = reactive({ }); // 如果需要解构,确保使用toRefs const { form, search_content } = toRefs(state); +console.log(form); const header_background_type_change_event = (val: any) => { if (val === 'color_image') { diff --git a/src/views/layout/components/main/index.vue b/src/views/layout/components/main/index.vue index 812aee82..1ae50ce3 100644 --- a/src/views/layout/components/main/index.vue +++ b/src/views/layout/components/main/index.vue @@ -181,16 +181,19 @@ watchEffect(() => { // 已选组件逻辑处理 const drawer_selected = ref(false); +const is_show_drawer = ref(true); watchEffect(() => { - if (diy_data.value.length > 0 || tabs_data.value.length > 0) { + if ((diy_data.value.length > 0 || tabs_data.value.length > 0) && is_show_drawer.value) { drawer_selected.value = true; } else { drawer_selected.value = false; } }); const toggle_drawer = () => { + is_show_drawer.value = !is_show_drawer.value; drawer_selected.value = !drawer_selected.value; }; + // 父组件调用的方法 const emits = defineEmits(['rightUpdate', 'import', 'export', 'clear']); const activeNames = reactive(['base', 'plugins', 'tool']); diff --git a/src/views/layout/index.vue b/src/views/layout/index.vue index 686b090f..548c3845 100644 --- a/src/views/layout/index.vue +++ b/src/views/layout/index.vue @@ -133,7 +133,14 @@ const init = () => { if (get_id()) { DiyAPI.getInit({ id: get_id() }).then((res: any) => { if (res.data) { - form.value = form_data_transfor_diy_data(res.data); + let data = form_data_transfor_diy_data(res.data); + // 默认数据合并 + data.header.com_data = default_merge(data.header.com_data, 'header_nav'); + data.footer.com_data = default_merge(data.footer.com_data, 'footer_nav'); + data.diy_data = data_merge(data.diy_data); + data.tabs_data = data_merge(data.tabs_data); + + form.value = data; } else { is_empty.value = true; } @@ -146,6 +153,19 @@ const init = () => { loading_event(); } }; +// 数据合并 +const data_merge = (list: string[]) => { + list.forEach((item: any) => { + item.com_data = default_merge(item.com_data, item.key);; + }); + return list; +}; +// 浅层数据合并 +const default_merge = (data: any, key: string) => { + data.style = Object.assign({}, cloneDeep((defaultSettings as any)[key.replace(/-/g, '_')]).style, data.style); + data.content = Object.assign({}, cloneDeep((defaultSettings as any)[key.replace(/-/g, '_')]), data.content); + return data; +}; // 初始化公共数据 const common_init = () => {