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

fix(Breadcrumb): when route.children exist, the path of children is wrong #16885

Merged
merged 4 commits into from
Jun 3, 2019

Conversation

haianweifeng
Copy link
Contributor

@haianweifeng haianweifeng commented May 30, 2019

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

👻 What's the background?

💡 Solution

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

<Menu.Item key={child.breadcrumbName || child.path}>
                {itemRender(child, params, routes, [...paths, this.getPath(child.path, params)])}
</Menu.Item>
itemRender(...args) 中路径应该到拼接当前child.path
getPath() 参数赋默认值
@afc163
Copy link
Member

afc163 commented May 30, 2019

Any reproduce.

@haianweifeng
Copy link
Contributor Author

haianweifeng commented May 30, 2019

const routes = [
  {
    path: 'first',
    breadcrumbName: 'first:name',
    children: [
      {
          path: '/general',
          breadcrumbName: 'General',
      },
      {
          path: '/layout',
          breadcrumbName: 'Layout',
      },
      {
          path: '/navigation',
          breadcrumbName: 'Navigation',
      }
    ]
  }
];

<Breadcrumb routes={routes} params={{ name: '测试' }} />

在这种情形下渲染的

<a href="#/first">General</a>

路径应该是'#/first/general'

对于子路径是否为空进行判断
@codecov
Copy link

codecov bot commented May 30, 2019

Codecov Report

Merging #16885 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16885      +/-   ##
==========================================
+ Coverage   95.96%      96%   +0.04%     
==========================================
  Files         263      263              
  Lines        7329     7337       +8     
  Branches     2048     2050       +2     
==========================================
+ Hits         7033     7044      +11     
+ Misses        294      291       -3     
  Partials        2        2
Impacted Files Coverage Δ
components/breadcrumb/Breadcrumb.tsx 96.61% <100%> (+0.53%) ⬆️
components/_util/wave.tsx 88.67% <0%> (+2.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update abb8692...c6ea0aa. Read the comment docs.

@afc163
Copy link
Member

afc163 commented May 30, 2019

Could you create a codesandbox: http://u.ant.design/codesandbox-repro

@ycjcl868
Copy link
Contributor

ci broken.

@haianweifeng
Copy link
Contributor Author

https://codesandbox.io/embed/antd-reproduction-template-m3qsw
image
当我点击first-Layout 时 浏览器地址没有显示到#/index/first/layout

@haianweifeng
Copy link
Contributor Author

haianweifeng commented Jun 3, 2019 via email

@afc163
Copy link
Member

afc163 commented Jun 3, 2019

image

@haianweifeng haianweifeng changed the title Fix breadcrumb fix(Breadcrumb): when route.children exist, the path of children is wrong Jun 3, 2019
@afc163 afc163 merged commit c2b1384 into ant-design:master Jun 3, 2019
@ikobe-zz ikobe-zz mentioned this pull request Jun 6, 2019
10 tasks
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

Successfully merging this pull request may close these issues.

None yet

3 participants