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: single breadcrumb item display separator #88

Merged
merged 7 commits into from
May 3, 2022

Conversation

likui628
Copy link
Collaborator

@likui628 likui628 commented May 3, 2022

Description

通过在路由的meta里增加hideBreadcrumb,避免单个面包屑显示分隔符

close #80

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).

@netlify
Copy link

netlify bot commented May 3, 2022

Deploy Preview for vue-hbs-admin ready!

Name Link
🔨 Latest commit eec085f
🔍 Latest deploy log https://app.netlify.com/sites/vue-hbs-admin/deploys/627116235dd1fc00087c3ef7
😎 Deploy Preview https://deploy-preview-88--vue-hbs-admin.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@likui628
Copy link
Collaborator Author

likui628 commented May 3, 2022

close #80

@alexzhang1030
Copy link
Collaborator

大佬,我看到你把 sort 改为非必填了,你顺便测试一下 meta.single 不是 true 的子路由,如果不填 sort 会不会出现问题,因为我当时写动态渲染菜单的时候做了一下根据 sort 强排列顺序

@Hongbusi
Copy link
Member

Hongbusi commented May 3, 2022

close #80

要写在描述里,才会关联并在合并后自动取消。

@likui628
Copy link
Collaborator Author

likui628 commented May 3, 2022

大佬,我看到你把 sort 改为非必填了,你顺便测试一下 meta.single 不是 true 的子路由,如果不填 sort 会不会出现问题,因为我当时写动态渲染菜单的时候做了一下根据 sort 强排列顺序

有warning,未设置sort时,进行比较时,默认值为多少合适

function sortBySortKey(routerModuleList: RouteModuleList | RouteModule['children']) {
  return routerModuleList!.sort((a: RouteModule, b: RouteModule) => (a.meta?.sort || 0) - (b.meta?.sort || 0))
}

@alexzhang1030
Copy link
Collaborator

大佬,我看到你把 sort 改为非必填了,你顺便测试一下 meta.single 不是 true 的子路由,如果不填 sort 会不会出现问题,因为我当时写动态渲染菜单的时候做了一下根据 sort 强排列顺序

有warning,未设置sort时,进行比较时,默认值为多少合适

function sortBySortKey(routerModuleList: RouteModuleList | RouteModule['children']) {
  return routerModuleList!.sort((a: RouteModule, b: RouteModule) => (a.meta?.sort || 0) - (b.meta?.sort || 0))
}

100 吧,默认不设置就放在后面

@likui628
Copy link
Collaborator Author

likui628 commented May 3, 2022

我觉得0也没问题,有的设置有的不设置,随便哪个作为缺省好像都说得过去

@likui628
Copy link
Collaborator Author

likui628 commented May 3, 2022

大佬,我看到你把 sort 改为非必填了,你顺便测试一下 meta.single 不是 true 的子路由,如果不填 sort 会不会出现问题,因为我当时写动态渲染菜单的时候做了一下根据 sort 强排列顺序

有warning,未设置sort时,进行比较时,默认值为多少合适

function sortBySortKey(routerModuleList: RouteModuleList | RouteModule['children']) {
  return routerModuleList!.sort((a: RouteModule, b: RouteModule) => (a.meta?.sort || 0) - (b.meta?.sort || 0))
}

100 吧,默认不设置就放在后面

既然你觉得应该放最后,那么我就缺省值为Number.MAX_VALUE

@alexzhang1030
Copy link
Collaborator

alexzhang1030 commented May 3, 2022

大佬,我看到你把 sort 改为非必填了,你顺便测试一下 meta.single 不是 true 的子路由,如果不填 sort 会不会出现问题,因为我当时写动态渲染菜单的时候做了一下根据 sort 强排列顺序

有warning,未设置sort时,进行比较时,默认值为多少合适

function sortBySortKey(routerModuleList: RouteModuleList | RouteModule['children']) {
  return routerModuleList!.sort((a: RouteModule, b: RouteModule) => (a.meta?.sort || 0) - (b.meta?.sort || 0))
}

100 吧,默认不设置就放在后面

既然你觉得应该放最后,那么我就缺省值为Number.MAX_VALUE

哈哈,都行,你说了算,没问题就行

src/layouts/default/header/components/Breadcrumb.vue Outdated Show resolved Hide resolved
types/routes.d.ts Outdated Show resolved Hide resolved
@Hongbusi
Copy link
Member

Hongbusi commented May 3, 2022

只通过 meta 里面的 title 去渲染面包屑,如果不存在直接过滤掉。这样处理感觉怎么样?

@Hongbusi Hongbusi merged commit 8faeedb into developer-plus:master May 3, 2022
@likui628 likui628 deleted the breadcrumb-single-route branch May 3, 2022 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

只存在一级面包屑时显示有问题
3 participants