import {computed} from 'vue'
import {page, pages} from "@/uni_modules/uv-ui-tools/libs/function";
import {getTabRoutes} from "@/common/mxConst";

export function useH5BackHome() {
    const hasPreviousPage = computed(() => {
        const allPages = pages()
        return allPages.length > 1
    })

    const shouldShowHome = computed(() => {
        if (hasPreviousPage.value) return false
        const tabs = getTabRoutes()
        const current = page()
        return !tabs.includes(current)
    })

    return {hasPreviousPage, shouldShowHome}
}
