Open crazyming9528 opened 1 year ago
There is two-way communication between host and web component via web component's properties and events. If this doesn't answer your question, please elaborate more what you want to achieve.
There is two-way communication between host and web component via web component's properties and events. If this doesn't answer your question, please elaborate more what you want to achieve.
Just like the useImperativeHandle hook in react, can expose the methods of components.
eg.
class MyElement extends HTMLElement {
...
doSomething() {
// do something in this method
}
const element = document.querySelector('my-element');
element.doSomething();
@PrimaMateria Can you help me solve this problem, it is very urgent, thank you very much
I don't have any knowledge about that, so I am not able to help you.
I don't have any knowledge about that, so I am not able to help you.
ok,thanks for your reply~
I use custom event to call a method inside the component
I would like to know how to provide component instance methods for external use, thank you