How to get the DOM element of a component in Mini Program

when developing Mini Program"s project, I customized two components, both of which are subcomponents of the front page, but now we need to get the DOM elements of another component in one component. How should I operate it?

Nov.11,2021

clipboard.png


seems to be impossible. I try to get an instance of a component with this.selectComponent (id) on the page page, and then put this instance on another component as a parameter (component), accept this parameter (component), on another component, and then use SelectorQuery.in (component). Select ('element'), but I can't get it either.


Mount components to app.globalData

// 
onLoad () {
    var coma = this.selectComponent('-sharpcoma')
    var comb = this.selectComponent('-sharpcomb')
    app.globalData.coma = coma
    app.globalData.comb = comb
  }

// comacomb
  ready () {
     console.log('comb', app.globalData.comb)
  }
Menu