在uni-app中,可以通过getCurrentPages()函数获取当前加载的页面栈,然后通过route属性获取当前页面的路由路径。 路由参数可以通过options属性获取。 在当前页面的脚本中调用该方法: 你可以在页面的onLoad生命周期钩子或者其他你需要的地方调用这个方法。 将获取的URL存储到变量中: 将获取的路由路径和参数存储到变量中,...
uniapp获取当前页面url exportfunctiongetUrl()varpages=getCurrentPages()//获取加载的页面varcurrentPage=pages[pages.length-1]//获取当前页面的对象varurl=currentPage.route//当前页面urluni.setStorage({key:'currentUrl',data:`/${url}`})//var options = currentPage.options //如果要获取url中所带的参...
问题描述 vue3 H5 环境下 运行npm run dev:h5,打开首页(http://localhost:3000/#/) 点击一个按钮通过uni.navigateTo到sub1页面(http://localhost:3000/#/pages/index/sub1) 在浏览器地址栏中,手动修改url地址到首页【要带上hash】(http://localhost:3000/#/) 首页(