Methods to access subcomponents in vue, and whether there are any methods to quickly access subcomponents at a deeper level

let b = this.$ refs [this.userRef]. $children [0]. $children [2]. $children [1]. $children [0]. $children [0]
console.info ("resetting" in b);
b.resetting ();
I am here, but I think it"s unreasonable. Is there any api that can access subcomponents at a deeper level?

Jun.10,2021

doesn't feel like a good way to directly access
can't you directly add a reference to a subcomponent?


Let's all throw events on the message bus.


you can try publish / subscribe mode


you can write this:

created () {
  window.myComponent = this;
}
window.myComponent&&window.myComponent.resetting&&window.myComponent.resetting()
Menu