mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-10 09:56:20 +00:00
Merge branch 'fix/rax-finddom' into 'release/0.9.8'
fix: rax finddom 方法重写 See merge request !940896
This commit is contained in:
commit
bb932fa3a3
@ -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