Skip to content

Conversation

@ZeroOneJs
Copy link

@ZeroOneJs ZeroOneJs commented Mar 18, 2024

Types of changes

  • New feature
  • Bug fix
  • Documentation change
  • Coding style change
  • Refactoring
  • Performance improvement
  • Test cases
  • Continuous integration
  • Typescript definition change
  • Breaking change

Background and context

如果路由配置中 meta.roles 都不定义默认值 ['*'] (官方开发文档中表示可以不定义这个字段),用户 role 字段为空字符串 '' 时会出现路由无限重定向问题,原因是 hooks/permission.ts 中如果 el.includes('') 会为被判断为 true 导致,这里 el 类型标注也有错误,应该为字符串而非数组
WX20240318-164326

Solution

使用 === 判断真假,将类型判断由数组改为字符串

How is the change tested?

Changelog

Changelog(CN) Changelog(EN) Related issues
修复路由无限重定向问题 fix infinite redirection of route

Checklist:

  • Provide changelog for relevant changes (e.g. bug fixes and new features) if applicable.
  • Changes are submitted to the appropriate branch (e.g. features should be submitted to feature branch and others should be submitted to master branch)

Other information

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.

1 participant