I don"t quite understand the role of relations in the relationship between components in WeChat Mini Programs. The instance in the document looks like this:
<custom-ul>
<custom-li> item 1 </custom-li>
<custom-li> item 2 </custom-li>
</custom-ul>
// path/to/custom-ul.js
Component({
relations: {
"./custom-li": {
type: "child" //
}
},
methods: {
_getAllLi: function(){
// getRelationNodesnodescustom-li
var nodes = this.getRelationNodes("path/to/custom-li")
}
},
ready: function(){
this._getAllLi()
}
})
// path/to/custom-li.js
Component({
relations: {
"./custom-ul": {
type: "parent" //
}
}
})
the following is my question:
The structure of the components in theinstance has indicated the nesting relationship
<custom-ul>
<custom-li> item 1 </custom-li>
<custom-li> item 2 </custom-li>
</custom-ul>
so what does the custom field relations represent? What are the examples of specific use?