mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-26 20:38:11 +00:00
fix: rax finddom 方法重写
This commit is contained in:
parent
4642f2dd99
commit
1d9092855c
@ -188,8 +188,23 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
|
|||||||
cursor.release();
|
cursor.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
findDOMNodes(instance: any): Array<Element | Text> | null {
|
findDOMNodes(instance: any, selector?: string): Array<Element | Text> | null {
|
||||||
return [raxFindDOMNodes(instance)];
|
let el = instance;
|
||||||
|
if (selector) {
|
||||||
|
el = document.querySelector(selector);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return raxFindDOMNodes(el);
|
||||||
|
} catch (e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
if (el && el.type && el.props && el.props.componentId) {
|
||||||
|
el = document.querySelector(`${el.type}[componentid=${el.props.componentId}]`);
|
||||||
|
} else {
|
||||||
|
console.error(instance);
|
||||||
|
throw new Error('This instance may not a valid element');
|
||||||
|
}
|
||||||
|
return raxFindDOMNodes(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user