Home > WeChat Applet > Mini Program Development > How to find the current page path of a mini program

How to find the current page path of a mini program

Release: 2020-04-02 10:31:35
Original
7515 people have browsed it

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template