Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SuperMan
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
SuperMan
Commits
029c5f92
Commit
029c5f92
authored
Aug 15, 2025
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
e1707fdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
index.js
src/plug/index.js
+24
-0
No files found.
src/plug/index.js
View file @
029c5f92
...
...
@@ -1987,5 +1987,29 @@ export default {
var
language
=
localStorage
.
getItem
(
'language'
)
return
language
;
}
Vue
.
prototype
.
deepFirstLetterToLower
=
function
(
obj
)
{
if
(
typeof
obj
!==
'object'
||
obj
===
null
)
return
obj
;
// 非对象直接返回
// 处理数组:遍历每个元素递归转换
if
(
Array
.
isArray
(
obj
))
{
return
obj
.
map
(
item
=>
deepFirstLetterToLower
(
item
));
}
// 处理普通对象:遍历键值对递归转换
const
newObj
=
{};
for
(
const
key
in
obj
)
{
const
value
=
obj
[
key
];
// 键名首字母转小写(可选,根据需求)
const
newKey
=
firstLetterToLower
(
key
);
newObj
[
newKey
]
=
deepFirstLetterToLower
(
value
);
}
return
newObj
;
}
// 基础首字母转小写函数(同上)
Vue
.
prototype
.
firstLetterToLower
=
function
(
str
)
{
if
(
typeof
str
!==
'string'
||
str
.
length
===
0
)
return
''
;
return
str
.
charAt
(
0
).
toLowerCase
()
+
str
.
slice
(
1
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment