diff --git a/packages/common/utils/url.ts b/packages/common/utils/url.ts index 20c0fae..0fcf66e 100644 --- a/packages/common/utils/url.ts +++ b/packages/common/utils/url.ts @@ -1,4 +1,4 @@ -export function appendParamsToUrl(url: string, pathname: string, params: Record) { +export function appendParamsToUrl(url = '', pathname = '', params: Record = {}) { // 创建一个新的URL对象,在末尾添加 pathname const urlObject = new URL(pathname, url) diff --git a/webs/log-web/src/views/iframe.vue b/webs/log-web/src/views/iframe.vue index 51a4303..f80a77a 100644 --- a/webs/log-web/src/views/iframe.vue +++ b/webs/log-web/src/views/iframe.vue @@ -26,7 +26,7 @@ export default { token: getToken(), ...(this.$route.query || {}) } - const url = appendParamsToUrl(this.url, this.$route.path + this.$route.meta?.pathname, params) + const url = appendParamsToUrl(this.url, this.$route.path + (this.$route.meta?.pathname || ''), params) console.log('iframeUrl: ', url) return url } diff --git a/webs/oms-web/src/views/iframe.vue b/webs/oms-web/src/views/iframe.vue index 13f9487..8eac4f5 100644 --- a/webs/oms-web/src/views/iframe.vue +++ b/webs/oms-web/src/views/iframe.vue @@ -26,7 +26,7 @@ export default { token: getToken(), ...(this.$route.query || {}) } - const url = appendParamsToUrl(this.url, this.$route.path + this.$route.meta?.pathname, params) + const url = appendParamsToUrl(this.url, this.$route.path + (this.$route.meta?.pathname || ''), params) console.log('iframeUrl: ', url) return url }