vue源码之驼峰转连字符

齐天大圣数据候 2020-04-26

var hyphenateRE = /\B([A-Z])/g; var hyphenate = function (str) { return str.replace(hyphenateRE, ‘-$1‘).toLowerCase() } console.log(hyphenate("aaaaDssssFcccc"));? ? //??aaaa-dssss-fcccc

// "-$1":捕获到什么字符$1就引用什么字符,字符加一个“-”

相关推荐

TiDBPingCAP / 0评论 2020-07-29