From 3a427ae888e1110eec4398def5417b7c24842779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Wed, 11 Jun 2025 12:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=95=E9=83=A8=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E4=BC=A0=E9=80=92type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/tabbar/index.vue | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/views/tabbar/index.vue b/src/views/tabbar/index.vue index c5725d7c..97d334ae 100644 --- a/src/views/tabbar/index.vue +++ b/src/views/tabbar/index.vue @@ -38,7 +38,7 @@ onMounted(() => { }); const is_empty = ref(false); const init = () => { - DiyAPI.getTabbar({ type: 'home' }) + DiyAPI.getTabbar({ type: get_type() }) .then((res: any) => { if (res.data) { let data = res.data; @@ -78,7 +78,7 @@ const save_disabled = ref(false); const save_event = () => { const clone_form = cloneDeep(form.value); const new_data = { - type: 'home', + type: get_type(), config: clone_form, }; save_disabled.value = true; @@ -93,6 +93,26 @@ const save_event = () => { save_disabled.value = false; }); }; +const get_type = () => { + let new_type = 'home'; + if (document.location.search.indexOf('/type/') != -1) { + new_type = document.location.search.substring(document.location.search.indexOf('/type/') + 6); + // 进行3次切割选择参数内容 + const result1 = splitAndGetFirst(new_type, '/'); + const result2 = splitAndGetFirst(result1, '&'); + return splitAndGetFirst(result2, '#'); + } else { + return new_type; + } +}; +function splitAndGetFirst(str: string, separator: string): string { + const data = str.split(separator); + if (data.length > 1) { + return data[0]; + } else { + return str; + } +} //#endregion 顶部导航回调方法 ---------------------end