更改动态导航栏

This commit is contained in:
wwz
2025-02-08 09:16:43 +08:00
parent 20b5539a82
commit 5add1f1282
33 changed files with 21325 additions and 72 deletions

37
framework/2-url.js Normal file
View File

@@ -0,0 +1,37 @@
const getUrl = (pageName, extras = null) => {
let url = '/pages/' + pageName + '/index'
if (pageName.indexOf('/pages') == 0) {
url = pageName
} else if(pageName.indexOf('/') != -1) {
url = '/pages/' + pageName
}
if (url == uni.utils.getCurrentRoute()) {
return
}
if (extras && JSON.stringify(extras) != '{}') {
url += '?' + uni.utils.transformRequest(extras)
}
return url
}
const getPageName = url => {
const matchs = url.match(/\/pages\/(.+)\/(.+)/i)
if (matchs.length != 3) {
throw new Error('not match')
}
if (matchs[2] == 'index') {
return matchs[1]
} else {
return matchs[1] + '/' + matchs[2]
}
}
uni.url = {
getUrl,
getPageName
}