hellof2e / quark-design

Browser-native component library, framework-agnostic, base on web components.(移动端 UI 组件库,无框架,即插即用。)
https://quark-ecosystem.github.io/quarkd-docs
MIT License
1.9k stars 189 forks source link

component(badge): code optimization #207

Closed Wing-9527 closed 1 year ago

Wing-9527 commented 1 year ago

我认为这里的正则判断有点多余,/\d/g只能判断字符串中是否包含一个数字。例如,当 content为 "a1bc"时,/\d/g.test(this.content)结果为 true,在做大小比较时才会为 false。renderContent方法返回 this.content