fix: id widgets by type index to prevent erasing memory in some cases
This commit is contained in:
parent
b5720355f9
commit
6a2486d9f2
1 changed files with 4 additions and 2 deletions
|
|
@ -53,10 +53,12 @@ export function transpiler(input, options = {}) {
|
|||
return this.replace(sliderWithLocation(node));
|
||||
}
|
||||
if (isWidgetMethod(node)) {
|
||||
const type = node.callee.property.name;
|
||||
const index = widgets.filter((w) => w.type === type).length;
|
||||
const widgetConfig = {
|
||||
to: node.end,
|
||||
index: widgets.length,
|
||||
type: node.callee.property.name,
|
||||
index,
|
||||
type,
|
||||
};
|
||||
emitWidgets && widgets.push(widgetConfig);
|
||||
return this.replace(widgetWithLocation(node, widgetConfig));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue