Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions demo/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,18 @@ export default {
nodechekced (node, v) {
alert('that a node-check envent ...' + node.title + v)
},
tpl (node, ctx) {
tpl (...args) {
// console.dir(args)
const {0: node, 2:parent} = args
let titleClass = node.selected ? 'node-title node-selected' : 'node-title'
if (node.searched) titleClass += ' node-searched'
return <span>
<button class="treebtn1" onClick={() => this.$refs.tree1.addNode(node, {title: 'sync node'})}>+</button>

<span class={titleClass} domPropsInnerHTML={node.title} onClick={() => {
this.$refs.tree1.nodeSelected(node)
}}></span>
<button class="treebtn2" onClick={() => this.asyncLoad1(node)}>async</button>
<button class="treebtn3" onClick={() => this.$refs.tree1.delNode(node.parent, node)}>delete</button>
<button class="treebtn3" onClick={() => this.$refs.tree1.delNode(parent, node)}>delete</button>
</span>
},
async asyncLoad1 (node) {
Expand Down
2 changes: 1 addition & 1 deletion dist/halower-tree.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/v2-tree.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/v2-tree.js.map

Large diffs are not rendered by default.

226 changes: 226 additions & 0 deletions src/components/tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,229 @@ export default {
}
}
</script>
<style>
.halo-tree li span:hover {
background-color: transparent;
/* padding: 6px 0; */
}
.fade-enter-active, .fade-leave-active {
transition: opacity .2s
}
.fade-enter, .fade-leave-to /* .fade-leave-active in below version 2.1.8 */ {
opacity: 0
}
.halo-tree .expand-enter-active {
transition:all 3s ease;
height:50px;
overflow:hidden;
}
.halo-tree .expand-leave-active {
transition:all 3s ease;
height:0px;
overflow:hidden;
}
.halo-tree .expand-enter, .halo-tree .expand-leave {
height:0;
opacity:0;
}
.halo-tree {
font-size:14px;
-webkit-transition: .3s height ease-in-out,.3s padding-top ease-in-out,.3s padding-bottom ease-in-out;
transition: .3s height ease-in-out,.3s padding-top ease-in-out,.3s padding-bottom ease-in-out;

}
.halo-tree ul {
box-sizing: border-box;
}
.halo-tree ul,.halo-tree li {
list-style-type:none;
text-align:left;
}
.halo-tree .inputCheck {
display:inline-block;
position:relative;
width:14px;
height:14px;
border:1px solid #888888;
border-radius:2px;
top:4px;
text-align:center;
font-size:14px;
line-height:14px;
}
.halo-tree .inputCheck.notAllNodes:before {
content:"\2713";
display:block;
position:absolute;
width:100%;
height:100%;
background-color:#888888;
z-index:1;
color:#ffffff;
}
.halo-tree .inputCheck.box-checked:after {
content:"\2713";
display:block;
position:absolute;
z-index:1;
width:100%;
text-align:center;
}
.halo-tree .box-halfchecked {
background-color: #888888;
}
.halo-tree .box-halfchecked:after {
content:"\2713";
display:block;
position:absolute;
z-index:1;
width:100%;
text-align:center;
color: #FFFFFF;
}
.halo-tree .check{
display:block;
position:absolute;
font-size:14px;
width:16px;
height:16px;
left:-5px;
top:-4px;
border:1px solid #000000;
opacity:0;
cursor:pointer;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter:alpha(opacity=0);
z-index:2;
}
.halo-tree .chkDisabled {
background-color: #F5F5F5;
opacity: 1;
cursor: not-allowed;
}
.halo-tree li {
margin: 0;
padding: 5px 5px 5px 15px;
position: relative;
list-style: none;
}
.halo-tree li:after,
.halo-tree li:before {
content: '';
left: -8px;
position: absolute;
right: auto;
border-width: 1px
}
.halo-tree li:before {
border-left: 1px dashed #999;
bottom: 50px;
height: 100%;
top: -8px;
width: 1px;
}
.halo-tree li:after {
border-top: 1px dashed #999;
height: 20px;
top: 17px;
width: 28px
}
.halo-tree li:last-child::before {
height: 26px
}
.halo-tree>li.first-node:before {
top: 17px;
}
.halo-tree>li.second-node:before {
top: 4px;
}
.halo-tree>li.first-node.only-node::before {
border-left: none;
}
.halo-tree>li.only-node:after {
border-top: none;
}
.halo-tree > ul {
padding-left: 0
}
.halo-tree ul {
padding-left: 17px;
padding-top: 10px;
}
.halo-tree .tree-expand{
display: inline-block;
width:14px;
height:14px;
text-align: center;
line-height: 13px;
border: 1px solid #888888;
border-radius: 2px;
background: #FFFFFF;
font-style: normal;
}
.halo-tree .tree-open {
line-height: 13px;
}
.halo-tree .tree-close:after {
content: "+";
}
.halo-tree .tree-open:after {
content: "\2013";
}
.halo-tree .tree-empty:after {
content: "";
}
.halo-tree .tree-node-el {
background-color: #FFFFFF;
padding-left: 2px;
position: relative;
z-index: 3;
}
.halo-tree li.leaf {
padding-left: 15px;
}
.halo-tree li.leaf:after {
content: '';
left: -7px;
position: absolute;
right: auto;
border-width: 1px;
border-top: 1px dashed #999;
height: 20px;
top: 17px;
width: 25px;
}
/*Dynamic style part*/
.halo-tree-search-box {
height: 18px;
line-height: 18px;
outline: none;
border: 1px solid #888888;
border-radius: 3px;
}
.halo-tree-search-box:focus {
border: 1px solid rgb(16, 142, 233);
-webkit-box-shadow: 0 2px 2px rgba(16, 142, 233, .2);
box-shadow: 0 2px 2px rgba(16, 142, 233,.2);
-webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
.halo-tree .node-title {
padding: 3px 3px;
border-radius: 3px;
cursor: pointer;
margin: 0 2px;
}
.halo-tree .node-title:hover{
background-color: #ccc;
}
.halo-tree .node-selected {
border: 1px solid #DDDDDD;
background-color: #DDDDDD;
}
.halo-tree .node-title.node-searched {
border: 1px solid #FF8247;
}
</style>

5 changes: 4 additions & 1 deletion src/components/treeLi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export default {
name: 'TreeLi',
mixins: [mixins],
components: {Render, Loading, CollapseTransition,
TreeUl: () => import('./treeUl.vue') // 解决循环引用的问题
// TreeUl: () => import('./treeUl.vue') // 解决循环引用的问题
},
beforeCreate() {
this.$options.components.TreeUl = require('./treeUl.vue').default
},
props: {
item: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/treeUl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</template>
<script>
import TreeLi from './treeLi'
import './tree.css'
// import './tree.css'
import mixins from './mixins'
export default {
name: 'TreeUl',
Expand Down