Home  >  Article  >  WeChat Applet  >  How to find the current page path of a mini program

How to find the current page path of a mini program

尚
Original
2020-04-02 10:31:357437browse

How to find the current page path of a mini program

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn