fix: 处理 iframe 参数兼容性

develop
时启龙 2024-09-04 18:50:29 +08:00
parent 6489b9910f
commit 43804edf45
1 changed files with 7 additions and 1 deletions

View File

@ -11,8 +11,14 @@ export function appendParamsToUrl(url = '', pathname = '', params: Record<string
}
// 设置URL的查询参数
let result = urlObject.toString()
if (result.endsWith('?')) {
if (result.endsWith('?') || result.endsWith('&')) {
result += searchParams.toString()
} else if (result.indexOf('?') > -1) {
if (result.endsWith('&')) {
result += searchParams.toString()
} else {
result += '&' + searchParams.toString()
}
} else {
result += '?' + searchParams.toString()
}