文章摘要:小程序页面路径参数怎么看 怎么查看小程序的页面路径
小程序获取当前页面路径及参数的代码: export function getCurrent […]
小程序获取当前页面路径及参数的代码:
export function 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
}