当前位置:首页 > 千层云服务器 > 正文

小程序页面路径参数怎么看

小程序页面路径参数怎么看

小程序获取当前页面路径及参数的代码:

exportfunctiongetCurrentPageUrlWithArgs(){

constpages=getCurrentPages()

constcurrentPage=pages[pages.length-1]

consturl=currentPage.route

constoptions=currentPage.options

leturlWithArgs=`/${url}?`

for(letkeyinoptions){

constvalue=options[key]

urlWithArgs+=`${key}=${value}&`

}

urlWithArgs=urlWithArgs.substring(0,urlWithArgs.length-1)

returnurlWithArgs

}


如果您对该产品感兴趣,请填写办理(客服微信:xiaoxiongyidong)

为您推荐:

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

在线客服