hello阿诚

有兴趣留言交流

uniapp获取当前页面路径和参数

let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
        let curRoute = routes[routes.length - 1].route //获取当前页面路由
        let curParam = routes[routes.length - 1].options; //获取路由参数
        // 拼接参数
        let param = ''
        for (let key in curParam) {
            param += '&' + key + '=' + curParam[key]
        }
        let data = {}
        data.curRoute = curRoute
        data.curParam = curParam

 

posted on 2021-04-16 09:48  陆秋明v  阅读(12816)  评论(0编辑  收藏  举报

导航