Use getCurrentPages to get an array of all page objects currently loading. The last one in the array is the current page.
var pages = getCurrentPages() //获取加载的页面 var currentPage = pages[pages.length-1] //获取当前页面的对象 var url = currentPage.route //当前页面url var options = currentPage.options //如果要获取url中所带的参数可以查看options
Recommended: "小program development tutorial"
The above is the detailed content of How to find the current page path of a mini program. For more information, please follow other related articles on the PHP Chinese website!