Skip to content

Commit

Permalink
支持复合属性
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Apr 22, 2024
1 parent 867886d commit 0576b8f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/customDefine/unitAttrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,24 @@ export class UnitAttrs extends BaseDefine {
if (typeof json !== 'object') {
return attrs;
}
if (!Array.isArray(json.c)) {
return attrs;
// 自定义单位属性
if (Array.isArray(json.c)) {
for (let item of json.c) {
let name = decodeURI(item.items?.[1]?.desc);
let key = item.items?.[1]?.key;
if (name && key) {
attrs.push({name, key});
}
}
}
for (let item of json.c) {
let name = decodeURI(item.items?.[1]?.desc);
let key = item.items?.[1]?.key;
if (name && key) {
attrs.push({name, key});
// 复合属性
if (Array.isArray(json.p)) {
for (let item of json.p) {
let name = decodeURI(item.items?.[1]?.d);
let key = item.items?.[1]?.k;
if (name && key) {
attrs.push({name, key});
}
}
}
} finally {
Expand Down

0 comments on commit 0576b8f

Please sign in to comment.