I want to improve the function, it is only a leaf node can choose, click on the leaf node can be expanded, but don't close the layer, I through the following methods, one click to close the layer, how to solve?
Tree. Render ({
Elem: '# selectTree'
, data: data
Click: function (node) {
Var $select=$($(this) [0]. Elem). Parents (" layui - form - select ");
If (node. Data. The children==null) {
//alert (node. Data. The title);
Layui - form - $select. RemoveClass (" selected "), find (" layui - select - title span "). The HTML (node. Data. The title). The end (). The find (" input: hidden [name='selectID'] "). The val (node. Data. Id);
}
The else {
//alert (node. Data. The title);
Layui. Stope (e);
}
}
});
CodePudding user response:
Enclosing tree yourself