first commit

This commit is contained in:
“FiboAI”
2021-12-02 16:32:40 +08:00
parent 10be8c192e
commit 49016794cc
164 changed files with 35631 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
export const GetdeepObj = (obj,length=true) =>{
if (typeof obj == 'object' && !Array.isArray(obj)) {
let arr = []
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
if (Array.isArray(obj[key])) {
let obj = {
value: key,
label: key,
}
if(length){
obj.children=[{
value: 'length()',
label: '长度',
valueType: 1,
}]
}else{
obj.children=[]
}
arr.push(obj)
} else if (typeof obj[key] == 'object' && obj[key] != null) {
arr.push({
value: key,
label: key,
children:GetdeepObj(obj[key],length)
})
} else {
arr.push({
value: key,
label: key,
valueType: typeof obj[key] == 'string' ? 2 : 1,
})
}
}
}
return arr
} else if (Array.isArray(obj)) {
let obj
if(length){
obj=[{
value: 'length()',
label: '长度',
valueType: 1,
}]
}else{
obj=[]
}
return obj
}
}