function pageUrl(){ // 获取当前页面的实例 const pages = getCurrentPages(); const currentPage = pages[pages.length - 1]; // 获取页面的完整URL const url = currentPage.route; // 页面路径 const options = currentPage.options; // 如果有查询参数,将会在这里 // 拼接URL let fullUrl = url + '?'; for (let key in options) { fullUrl += `${key}=${options[key]}&`; } fullUrl = fullUrl.substring(0, fullUrl.length - 1); // 移除最后一个"&" return fullUrl } export default pageUrl