×

欢迎光临,有什么想法就留言告诉我吧!

你的精彩评论可能会出现在这里哦! 留言抢沙发

Vue

uniapp获取当前路径

admin admin 发表于2024-12-13 浏览412 评论0
// 获取当前页面栈数组
const pages = getCurrentPages();

// 获取当前页面(数组中的最后一个)
const currentPage = pages[pages.length - 1];

// 获取当前页面路径
const currentPath = currentPage.route;

// 全部路径
const fullPath =  pages[pages.length - 1].$page.fullPath;

console.log(currentPath);