useH5BackHome.js 554 B

12345678910111213141516171819
  1. import {computed} from 'vue'
  2. import {page, pages} from "@/uni_modules/uv-ui-tools/libs/function";
  3. import {getTabRoutes} from "@/common/mxConst";
  4. export function useH5BackHome() {
  5. const hasPreviousPage = computed(() => {
  6. const allPages = pages()
  7. return allPages.length > 1
  8. })
  9. const shouldShowHome = computed(() => {
  10. if (hasPreviousPage.value) return false
  11. const tabs = getTabRoutes()
  12. const current = page()
  13. return !tabs.includes(current)
  14. })
  15. return {hasPreviousPage, shouldShowHome}
  16. }