UNPKG

bmfe-mina-template

Version:

BM 小程序模板

18 lines (15 loc) 443 B
export default function getUrl() { const pages = getCurrentPages() const currentPage = pages[pages.length-1] const url = currentPage.route const options = currentPage.options const paramsKeyArr = Object.keys(options) let params = '' if(paramsKeyArr.length) { params += '?' paramsKeyArr.forEach(el => { params += `${el}=${options[el]}` }) } return '/' + url + params }