diff --git a/src/components/Swiper/mobile/index.vue b/src/components/Swiper/mobile/index.vue index f0d4638..1ebfc10 100644 --- a/src/components/Swiper/mobile/index.vue +++ b/src/components/Swiper/mobile/index.vue @@ -134,14 +134,14 @@ const { top: 50%; left: 0; right: 0; - padding: 0 8px; /* no */ + padding: 0 8px; z-index: 10; pointer-events: none; .nav-btn { pointer-events: auto; - width: 32px; /* no */ - height: 32px; /* no */ + width: 32px; + height: 32px; border: none; border-radius: 50%; background: rgba(255, 255, 255, 0.9); diff --git a/src/components/downloadImg/index.vue b/src/components/downloadImg/index.vue index f5143e2..663f10f 100644 --- a/src/components/downloadImg/index.vue +++ b/src/components/downloadImg/index.vue @@ -15,38 +15,106 @@ const options = { diff --git a/src/views/layout/mobile/index.vue b/src/views/layout/mobile/index.vue index 3adea47..448f451 100644 --- a/src/views/layout/mobile/index.vue +++ b/src/views/layout/mobile/index.vue @@ -3,53 +3,58 @@ import {ref, onMounted, watch} from 'vue' import {useRouter} from 'vue-router' import {useNavStore} from '@/store/nav' import {storeToRefs} from 'pinia' -import {Menu, ArrowDown, ArrowRight} from '@element-plus/icons-vue' +import {Menu, ArrowDown} from '@element-plus/icons-vue' const navStore = useNavStore() const {navIndex} = storeToRefs(navStore) const router = useRouter() -const sidebarVisible = ref(false) const navList = ref([]) const activeIndex = ref('/') -const expandedSubMenus = ref([]) - -const toggleSidebar = () => { - sidebarVisible.value = !sidebarVisible.value -} - -const closeSidebar = () => { - sidebarVisible.value = false -} - -const toggleSubMenu = (navId) => { - const idx = expandedSubMenus.value.indexOf(navId) - if (idx > -1) { - expandedSubMenus.value.splice(idx, 1) - } else { - expandedSubMenus.value.push(navId) - } -} +const expandedMenuId = ref(null) const getTargetUrl = (nav) => { return nav.mobileUrl || nav.url } +const isNavActive = (nav) => { + if (activeIndex.value === getTargetUrl(nav)) return true + if (nav.children?.length > 0) { + return nav.children.some((child) => activeIndex.value === getTargetUrl(child)) + } + return false +} + const handleNavClick = (nav) => { if (nav.hasChildren || nav.children?.length > 0) { - toggleSubMenu(nav.id) + expandedMenuId.value = expandedMenuId.value === nav.id ? null : nav.id return } + expandedMenuId.value = null if (nav.open) { window.open(nav.url) - sidebarVisible.value = false return } const targetUrl = getTargetUrl(nav) navStore.changeNavIndex(targetUrl) activeIndex.value = targetUrl router.push(targetUrl) - sidebarVisible.value = false +} + +const handleChildClick = (child) => { + expandedMenuId.value = null + if (child.open) { + window.open(child.url) + return + } + const targetUrl = getTargetUrl(child) + navStore.changeNavIndex(targetUrl) + activeIndex.value = targetUrl + router.push(targetUrl) +} + +const closeDropdown = () => { + expandedMenuId.value = null } watch( @@ -73,52 +78,53 @@ const toMIIF = () => {
- - -
- - -