From e6fa0f08488a07454865fc610d627fad1b254e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E5=90=AF=E9=BE=99?= Date: Sun, 1 Sep 2024 15:40:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20iframe=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/components/AppsList.vue | 4 ++-- src/utils/url.ts | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/layouts/components/AppsList.vue b/src/layouts/components/AppsList.vue index 88c9012..780393c 100644 --- a/src/layouts/components/AppsList.vue +++ b/src/layouts/components/AppsList.vue @@ -68,8 +68,8 @@ export default { token: getTrxToken() } const url = appendParamsToUrl(item.appAddress, '', params) - console.log('跳转应用时完整地址: ', url.toString()) - window.open(url.toString(), '_blank') + console.log('跳转应用时完整地址: ', url) + window.open(url, '_blank') } return { diff --git a/src/utils/url.ts b/src/utils/url.ts index 7e723ac..20c0fae 100644 --- a/src/utils/url.ts +++ b/src/utils/url.ts @@ -9,10 +9,13 @@ export function appendParamsToUrl(url: string, pathname: string, params: Record< for (const key in params) { searchParams.append(key, params[key]) } - // 设置URL的查询参数 - urlObject.search = searchParams.toString() - + let result = urlObject.toString() + if (result.endsWith('?')) { + result += searchParams.toString() + } else { + result += '?' + searchParams.toString() + } // 返回处理后的URL字符串 - return urlObject.toString() + return result }