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 }