mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-14 19:15:06 +08:00
fix: 路由地址转首字母大写驼峰,作为路由名称,适配keepAlive
This commit is contained in:
@ -427,3 +427,15 @@ export function isNumberStr(str) {
|
||||
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
|
||||
}
|
||||
|
||||
// -转驼峰
|
||||
export function toCamelCase(str, upperCaseFirst) {
|
||||
str = (str || '').toLowerCase().replace(/-(.)/g, function (match, group1) {
|
||||
return group1.toUpperCase();
|
||||
});
|
||||
|
||||
if (upperCaseFirst && str) {
|
||||
str = str.charAt(0).toUpperCase() + str.slice(1);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
Reference in New Issue
Block a user