{
/**
* 获取当前页面
*/
getCurrentPageUrl() {
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const url = `/${currentPage.route}`
return url
},
/**
* 获取当前页面路径与参数
*/
getCurrentPageUrlWithArgs() {
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const url = currentPage.route
const options = currentPage.options
let urlWithArgs = `/${url}?`
for (let key in options) {
const value = options[key]
urlWithArgs += `${key}=${value}&`
}
urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1)
return urlWithArgs
},
}
小程序获取当前页面路径与参数
最新推荐文章于 2025-09-18 14:51:48 发布
1063

被折叠的 条评论
为什么被折叠?



