+
@@ -45,9 +48,18 @@ const emits = defineEmits(['page_settings']);
const page_settings = () => {
emits('page_settings');
};
+// 监听props.pageData
+watch(
+ () => props.pageData,
+ (newVal) => {
+ console.log(newVal, 'header');
+ },
+ { immediate: true, deep: true }
+);
+
const form = computed(() => props.pageData.com_data.content);
const new_style = computed(() => props.pageData.com_data.style);
-const position = computed(() => new_style.value.up_slide_display == '1' ? 'absolute' : 'relative');
+const position = computed(() => (new_style.value.up_slide_display == '1' ? 'absolute' : 'relative'));
const roll_style = computed(() => {
let style = ``;
const { header_background_img, header_background_img_style, header_background_color_list, header_background_direction, header_background_type } = new_style.value;
@@ -66,7 +78,7 @@ const url_computer = (name: string) => {
const new_url = ref(new URL(`../../assets/images/layout/main/${name}.png`, import.meta.url).href).value;
return new_url;
};
-const text_style = computed(() => `font-weight:${ new_style.value.header_background_title_typeface }; font-size: ${ new_style.value.header_background_title_size }px; color: ${ new_style.value.header_background_title_color };`);
+const text_style = computed(() => `font-weight:${new_style.value.header_background_title_typeface}; font-size: ${new_style.value.header_background_title_size}px; color: ${new_style.value.header_background_title_color};`);
diff --git a/src/views/layout/components/main/index.vue b/src/views/layout/components/main/index.vue
index ec22ed69..c004411c 100644
--- a/src/views/layout/components/main/index.vue
+++ b/src/views/layout/components/main/index.vue
@@ -266,7 +266,7 @@ const toggle_drawer = () => {
drawer_selected.value = !drawer_selected.value;
};
// 父组件调用的方法
-const emits = defineEmits(['rightUpdate', 'import', 'export']);
+const emits = defineEmits(['rightUpdate', 'import', 'export', 'clear']);
const activeNames = reactive(['base', 'plugins', 'tool']);
interface componentsData {
name: string;
@@ -583,10 +583,8 @@ const upload_change = async (uploadFile: UploadFile) => {
// 清空列表
const clear_click = () => {
app?.appContext.config.globalProperties.$common.message_box('清空后不可恢复,确定继续吗?', 'warning').then(() => {
- page_data.value.com_data = cloneDeep(defaultSettings.header_nav);
- footer_nav.value.com_data = cloneDeep(defaultSettings.footer_nav);
- diy_data.value = [];
page_settings();
+ emits('clear');
});
};
//#endregion
diff --git a/src/views/layout/index.vue b/src/views/layout/index.vue
index 7ea21058..21153754 100644
--- a/src/views/layout/index.vue
+++ b/src/views/layout/index.vue
@@ -4,7 +4,7 @@
@@ -90,11 +90,12 @@ const api_count = ref(0);
const right_update = (item: any, diy: [Array
], header: headerAndFooter, footer: headerAndFooter) => {
diy_data_item.value = item;
form.value.diy_data = diy;
- // form.value.header = header;
- // form.value.footer = footer;
+ form.value.header = header;
+ form.value.footer = footer;
// 生成随机id
key.value = Math.random().toString(36).substring(2);
};
+// 导入数据
const import_data_event = (uploadFile: UploadFile) => {
// 截取document.location.search字符串内id/后面的所有字段
const form_data = new FormData();
@@ -110,9 +111,15 @@ const import_data_event = (uploadFile: UploadFile) => {
init();
});
};
+// 导出数据
const export_data_event = () => {
save_formmat_form_data(form.value, false, true);
};
+// 清空数据
+const clear_data_event = () => {
+ let new_tem_form = cloneDeep(temp_form.value);
+ form.value = new_tem_form;
+};
//#region 页面初始化数据 ---------------------start
// 页面加载
onBeforeMount(async () => {