收藏
回答

getCurrentPages API会对地址参数进行转码?

例如:const parmas = encodeURIComponent("工程备案") // "%E5%B7%A5%E7%A8%8B%E5%A4%87%E6%A1%88"

当前页面地址参数为: /page/index.html?name=parmas

const pages = await getCurrentPages()

const currentPage = pages[pages.length - 1];

const currentPath = currentPage?.$page.fullPath;

console.log(currentPath) // /page/index.html?name="%25E5%25B7%25A5%25E7%25A8%258B%25E5%25A4%2587%25E6%25A1%2588"

又进行了一次转码,需要两次解码 decodeURIComponent(decodeURIComponent("%25E5%25B7%25A5%25E7%25A8%258B%25E5%25A4%2587%25E6%25A1%2588")) // "工程备案"

请问这是正常的吗?

回答关注问题邀请回答
收藏
登录 后发表内容