You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
606 B
17 lines
606 B
|
3 years ago
|
/**
|
||
|
|
* @description: 获取当前页带参数的完整url
|
||
|
|
* @return {String}
|
||
|
|
*/
|
||
|
|
export default function getCurrentPageQueryPath() {
|
||
|
|
const pages = getCurrentPages(); // 获取加载的页面
|
||
|
|
const currentPage = pages[pages.length - 1]; // 获取当前页面的对象
|
||
|
|
const url = currentPage.route; // 当前页面url
|
||
|
|
const options = currentPage.options; // 如果要获取url中所带的参数可以查看options
|
||
|
|
// 拼接url的参数
|
||
|
|
let urlWithArgs = '/' + url + '?';
|
||
|
|
for (const key in options) {
|
||
|
|
urlWithArgs += key + '=' + options[key] + '&';
|
||
|
|
}
|
||
|
|
return urlWithArgs.slice(0, -1);
|
||
|
|
}
|