This commit is contained in:
Rizky 2023-12-17 11:40:35 +07:00
parent af094f44f2
commit 603e687d70
2 changed files with 23 additions and 19 deletions

View File

@ -70,24 +70,28 @@ export const parseJs = (meta: IMeta) => {
attr.type === "JSXAttribute" &&
attr.name.type === "JSXIdentifier"
) {
if (attr.value) {
if (
attr.value.type === "JSXExpressionContainer" &&
attr.value.expression.loc
) {
const loc = attr.value.expression.loc as any;
passprop[attr.name.name] = {
value: code.substring(loc.start.index, loc.end.index),
index: loc.start.index,
};
} else if (attr.value.loc) {
const loc = attr.value.loc as any;
passprop[attr.name.name] = {
value: code.substring(loc.start.index, loc.end.index),
index: loc.start.index,
};
}
}
passprop[attr.name.name] = {
value: '0',
index: 0,
};
// if (attr.value) {
// if (
// attr.value.type === "JSXExpressionContainer" &&
// attr.value.expression.loc
// ) {
// const loc = attr.value.expression.loc as any;
// passprop[attr.name.name] = {
// value: code.substring(loc.start.index, loc.end.index),
// index: loc.start.index,
// };
// } else if (attr.value.loc) {
// const loc = attr.value.loc as any;
// passprop[attr.name.name] = {
// value: code.substring(loc.start.index, loc.end.index),
// index: loc.start.index,
// };
// }
// }
}
}
}

View File

@ -58,7 +58,7 @@ effect={async (local) => {
);
}}
>
<Passprop/>
<PassProp/>
</Button>
</div>
);