diff --git a/lib/index.js b/lib/index.js index e7b4e58..3692f06 100644 --- a/lib/index.js +++ b/lib/index.js @@ -383,8 +383,6 @@ selectToggle: function selectToggle(val, node) { var _this2 = this; - console.log('val:::', val); - if (!this.tree.checkStrictly) { var exceptDisabledChecked = node.isExceptDisabledChecked(); Object.assign(node.data, { @@ -418,24 +416,26 @@ vNode: this }); } - - console.log('this.tree.checkedNodes:::', this.tree.checkedNodes); }, clickContent: function clickContent() { - console.log('clickContent'); this.tree.handleClickNode(this); }, handleClickCheckBox: function handleClickCheckBox(e) { e.stopPropagation(); }, - renderExpandSlot: function renderExpandSlot() { + renderExpand: function renderExpand() { var h = this.$createElement; - var expandIconSlot = this.tree.$scopedSlots.expandIcon; + var _this$tree2 = this.tree, + expandIconSlot = _this$tree2.$scopedSlots.expandIcon, + lazy = _this$tree2.lazy; var node = this.node, toggleFold = this.toggleFold, visibleExpand = this.visibleExpand; - var expanded = node.data.expanded; - return expandIconSlot ? h("div", { + var _node$data = node.data, + expanded = _node$data.expanded, + isLeaf = _node$data.isLeaf, + children = node.children; + return children && children.length || lazy && !isLeaf ? expandIconSlot ? h("div", { "style": { display: visibleExpand } @@ -450,21 +450,21 @@ return toggleFold(node); } } - }, ["\u25BC"]); + }, ["\u25BC"]) : null; }, renderCheckbox: function renderCheckbox() { var h = this.$createElement; var node = this.node, handleClickCheckBox = this.handleClickCheckBox, selectToggle = this.selectToggle; - var _this$tree2 = this.tree, - checkboxSlot = _this$tree2.$scopedSlots.checkbox, - showCheckbox = _this$tree2.showCheckbox; - var _node$data = node.data, - checked = _node$data.checked, - partialSelected = _node$data.partialSelected, - exceptDisabledChecked = _node$data.exceptDisabledChecked, - disabled = _node$data.disabled; + var _this$tree3 = this.tree, + checkboxSlot = _this$tree3.$scopedSlots.checkbox, + showCheckbox = _this$tree3.showCheckbox; + var _node$data2 = node.data, + checked = _node$data2.checked, + partialSelected = _node$data2.partialSelected, + exceptDisabledChecked = _node$data2.exceptDisabledChecked, + disabled = _node$data2.disabled; return showCheckbox ? checkboxSlot ? checkboxSlot({ handleClickCheckBox: handleClickCheckBox, selectToggle: selectToggle, @@ -512,7 +512,7 @@ var h = arguments[0]; var clickContent = this.clickContent, activeNode = this.activeNode, - renderExpandSlot = this.renderExpandSlot, + renderExpand = this.renderExpand, renderCheckbox = this.renderCheckbox, renderLoading = this.renderLoading, renderNodeName = this.renderNodeName; @@ -520,7 +520,7 @@ "class": ['node-content', { 'active-li': activeNode }] - }, [renderExpandSlot(), h("div", { + }, [renderExpand(), h("div", { "class": ['inner-wrap'], "on": { "click": clickContent