vue-treeselect

DOC

去除children数组为空的方法

let isObject = (arg) => typeof arg === 'object';

/**
 * 
 * @param {Object} o :: the object being cleaned
 * @param {String|Number} key :: the key or index to be cleaned from `o`
 */
function removeKey(o, key="") {

    if (key === "") {
        return o;
    }

    isObject(o) && Object.keys(o).forEach(function (k) {
        (k === key && o[k] && o[k].length === 0) && delete o[k] ||
            (o[k] && isObject(o[k]) && removeKey(o[k], key))
    });
    return o;
}

//使用方法
let data = removeKey(tree数组, 要去除的key名称)

children的问题 #104

基于 element-ui 2.x 扩展下拉带树的组件 下拉树状菜单