How does the view tree component refresh the node manually?

problem description

iview"s official website only introduces binding load-data attributes. Clicking the arrow symbol with the mouse will asynchronously load the data and expand the node. What should I do if I want to trigger this process directly with the code?

the environmental background of the problems and what methods you have tried

it is not possible to call loadData directly, because you cannot get the second parameter, callback,callback, which contains the context of the tree component and must be passed in by the component itself

related codes

loadData: function (item, callback) {
    this.$get(this.url + item.id, function (res) {
        if(res.data && res.data.length > 0){
            callback(res.data);
        }else{
            item.loading = false;
        }
    })
}
Mar.29,2022

ask the same question. The
project needs to take the initiative to find a certain level, but the tree is asynchronous. The level may not have been loaded


try async await?


in order to modify custom tree components, I separately copy the source code tree components to the project
part of the path defined by myself. Do not make mistakes in references
clipboard.png

clipboard.png

clipboard.png

clipboard.png

.
Menu