0
我又来请教一个方法了。 掩面哭泣
source link: https://www.v2ex.com/t/842804
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
const list = {
email: {
a: {
big: {
rule: ['abig'],
isShow: true,
extends: []
},
small: {
rule: ['asmall'],
isShow: false,
extends: []
}
},
b: {
big: {
rule: ['bbig'],
isShow: true,
extends: []
},
small: {
rule: ['bsmall'],
isShow: false,
extends: []
}
},
},
qq: {
a: {
big: {
rule: ['abigqq'],
isShow: true,
extends: []
},
small: {
rule: ['asmallqq'],
isShow: false,
extends: []
}
},
b: {
big: {
rule: ['bbigqq'],
isShow: true,
extends: []
},
small: {
rule: ['bsmallqq'],
isShow: false,
extends: []
}
},
},
}
比如说 我传入了 a big 那么就取 qq 和 email 下 a => big 里面的转化成下面格式的 对象
const data = {
rule: {
email: ['abigemail'],
qq: ['abigqq']
},
ishow: {
email: true,
qq: false
},
extends: {
email: [],
qq: []
}
}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK