Iview tree component, how to get the inside of the currently checked node

clipboard.png

The

getCheckedNodes method and the on-check-change method get all the checked nodes. I need to return the contents of that node when the check box is triggered and when the check box is checked and unchecked, respectively.

at present, an idea is to save a copy of the data of all selected nodes before the check operation, and then compare it with the array of selected nodes returned after the check operation, so as to obtain the difference between the two. When the parent node is not triggered, this method is effective, and only one-level parent, it can also be dealt with, but when there is a multi-level parent linkage, the difference data will be obtained, and it is difficult to locate the current node clicked.

can you tell me what the gods can do?

Feb.28,2022

our own solution is to extract the tree components and add the method of getting checked nodes.


has the problem been solved? Landlord


this requirement can certainly be met by a robust plug-in. Read the documentation carefully. The on-select-change and on-check-change methods have two parameters, the first is all, and the second is current:

// template
<Tree @on-check-change="checkItem"/>

// script
checkItem (selectedArr, selectedItem) {
    // selectedItem...
}
Menu