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

关于 symbolId 出现以 - 开头的情况 #92

Open
vanchKong opened this issue Aug 14, 2023 · 1 comment
Open

关于 symbolId 出现以 - 开头的情况 #92

vanchKong opened this issue Aug 14, 2023 · 1 comment

Comments

@vanchKong
Copy link

id = id.replace('--', '-')

symbolId 需要设置成 [dir]-[name] ,且非嵌套目录的情况下

[icon]-[dir]-[name] > [icon]--[name]
[dir]-[name] > -[name]
if (!dirName) {
    id = id.replace("--", "-");
    id = id.startsWith('-') ? id. substring(1) : id
}
@vanchKong
Copy link
Author

直接在上面的判断后面加这个会更好点,考虑了不写 [dir]的情况,单独加个分隔符的入参更好

  id = id.startsWith('-') ? id. substring(1) : id
  id = id.replace(/\[name\]/g, fName).split('/').slice(-1)[0];

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