Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

子应用如果是 hash 路由的话,在子应用中会拿不到设置的 hash 路由值 #1498

Open
Fov6363 opened this issue Jan 11, 2025 · 0 comments

Comments

@Fov6363
Copy link

Fov6363 commented Jan 11, 2025

问题描述

问题的具体描述

我的子应用地址设置的是:https://xxx/profile/?id=xxx#/participated

但在子应用中实际拿不到 /participated

看源码是

export function formatAppURL(url: string | null, appName: string | null = null): string {

export function formatAppURL(url: string | null, appName: string | null = null): string {
  if (!isString(url) || !url) return ''

  try {
    const { origin, pathname, search } = createURL(addProtocol(url), (window.rawWindow || window).location.href)
    /**
     * keep the original url unchanged, such as .html .node .php .net .etc, search, except hash
     * BUG FIX: Never using '/' to complete url, refer to https://github.com/jd-opensource/micro-app/issues/1147
     */
    const fullPath = `${origin}${pathname}${search}`
    return /^https?:\/\//.test(fullPath) ? fullPath : ''
  } catch (e) {
    logError(e, appName)
    return ''
  }
}

想问一下为什么要把子应用 url 的 hash 给干掉,这个会有什么问题吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant