chore: initial commit

This commit is contained in:
2026-07-30 18:04:37 +08:00
commit 2ffacfd668
356 changed files with 43448 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
const HOME_URL = '/pages/home/home'
export function getCurrentRoute() {
if (typeof getCurrentPages !== 'function') return ''
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
return currentPage ? currentPage.route || '' : ''
}
export function navigateBackOr(fallbackUrl = HOME_URL) {
const pages = typeof getCurrentPages === 'function' ? getCurrentPages() : []
if (pages.length > 1) {
uni.navigateBack({ fail: () => uni.reLaunch({ url: fallbackUrl }) })
return
}
uni.reLaunch({ url: fallbackUrl })
}
export function navigateToUnique(url) {
const route = url.split('?')[0].replace(/^\//, '')
if (getCurrentRoute() === route) return
uni.navigateTo({ url })
}