瀏覽代碼

port hyphenate fix

Evan You 10 年之前
父節點
當前提交
06ca85d633
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/shared/util.js

+ 2 - 1
src/shared/util.js

@@ -99,9 +99,10 @@ export const capitalize = cached((str: string): string => {
 /**
  * Hyphenate a camelCase string.
  */
-const hyphenateRE = /([a-z\d])([A-Z])/g
+const hyphenateRE = /([^-])([A-Z])/g
 export const hyphenate = cached((str: string): string => {
   return str
+    .replace(hyphenateRE, '$1-$2')
     .replace(hyphenateRE, '$1-$2')
     .toLowerCase()
 })