update Tree
update Tree
This commit is contained in:
parent
e81207a2a2
commit
b923c8187c
5 changed files with 56 additions and 38 deletions
|
@ -36,6 +36,10 @@
|
|||
checked: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
indeterminate: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
@ -62,7 +66,8 @@
|
|||
`${prefixCls}`,
|
||||
{
|
||||
[`${prefixCls}-checked`]: this.selected,
|
||||
[`${prefixCls}-disabled`]: this.disabled
|
||||
[`${prefixCls}-disabled`]: this.disabled,
|
||||
[`${prefixCls}-indeterminate`]: this.indeterminate
|
||||
}
|
||||
];
|
||||
},
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Icon from '../icon';
|
||||
import Icon from '../icon/icon.vue';
|
||||
const prefixCls = 'ivu-collapse';
|
||||
|
||||
export default {
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
<template>
|
||||
<ul :class="classes">
|
||||
<li v-for="item in data" :class="itemCls(item)">
|
||||
<span :class="arrowCls(item)" @click="setExpand(item.disabled, $index)"></span>
|
||||
<span v-if="showCheckbox" :class="checkboxCls(item)" @click="setCheck(item.disabled||item.disableCheckbox,$index)">
|
||||
<span :class="[prefixCls + '-checkbox-inner']"></span>
|
||||
<span :class="arrowCls(item)" @click="setExpand(item.disabled, $index)">
|
||||
<Icon type="arrow-right-b"></Icon>
|
||||
</span>
|
||||
<!--<span v-if="showCheckbox" :class="checkboxCls(item)" @click="setCheck(item.disabled||item.disableCheckbox,$index)">-->
|
||||
<!--<span :class="[prefixCls + '-checkbox-inner']"></span>-->
|
||||
<!--</span>-->
|
||||
<Checkbox
|
||||
:checked="item.checked && item.childrenCheckedStatus == 2"
|
||||
:disabled="item.disabled || item.disableCheckbox"
|
||||
@click.prevent="setCheck(item.disabled||item.disableCheckbox,$index)"></Checkbox>
|
||||
<a :class="titleCls(item)" @click="setSelect(item.disabled, $index)">
|
||||
<span :class="[prefixCls + '-title']" v-html="item.title"></span>
|
||||
</a>
|
||||
|
@ -21,12 +27,15 @@
|
|||
</ul>
|
||||
</template>
|
||||
<script>
|
||||
import Icon from '../icon/icon.vue';
|
||||
import Checkbox from '../checkbox/checkbox.vue';
|
||||
import { t } from '../../locale';
|
||||
|
||||
const prefixCls = 'ivu-tree';
|
||||
|
||||
export default {
|
||||
name: 'tree',
|
||||
components: { Icon, Checkbox },
|
||||
props: {
|
||||
data: {
|
||||
type: Array,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
.@{tree-prefix-cls} {
|
||||
margin: 0;
|
||||
padding: 5px;
|
||||
font-size: 12px;
|
||||
font-size: @font-size-small;
|
||||
li {
|
||||
padding: 0;
|
||||
margin: 7px 0;
|
||||
|
@ -46,14 +46,14 @@
|
|||
}
|
||||
a {
|
||||
display: inline-block;
|
||||
padding: 1px 5px;
|
||||
border-radius: 2px;
|
||||
margin: 0;
|
||||
padding: 1px 5px;
|
||||
border-radius: @btn-border-radius-small;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
vertical-align: top;
|
||||
color: #666;
|
||||
transition: all 0.3s ease;
|
||||
color: @text-color;
|
||||
transition: all @transition-time @ease-in-out;
|
||||
&:hover {
|
||||
background-color: tint(@primary-color, 90%);
|
||||
}
|
||||
|
@ -67,43 +67,47 @@
|
|||
}
|
||||
&.@{tree-prefix-cls}-switcher,
|
||||
&.@{tree-prefix-cls}-iconEle {
|
||||
margin: 0;
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
border: 0 none;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
}
|
||||
&.@{tree-prefix-cls}-icon_loading {
|
||||
&:after {
|
||||
display: inline-block;
|
||||
//.iconfont-font("\e6a1");
|
||||
animation: loadingCircle 1s infinite linear;
|
||||
color: @primary-color;
|
||||
}
|
||||
}
|
||||
//&.@{tree-prefix-cls}-icon_loading {
|
||||
// &:after {
|
||||
// display: inline-block;
|
||||
// //.iconfont-font("\e6a1");
|
||||
// animation: loadingCircle 1s infinite linear;
|
||||
// color: @primary-color;
|
||||
// }
|
||||
//}
|
||||
&.@{tree-prefix-cls}-switcher {
|
||||
i{
|
||||
transition: all @transition-time @ease-in-out;
|
||||
}
|
||||
&.@{tree-prefix-cls}-switcher-noop {
|
||||
cursor: auto;
|
||||
i{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&.@{tree-prefix-cls}-roots_open,
|
||||
&.@{tree-prefix-cls}-center_open,
|
||||
&.@{tree-prefix-cls}-bottom_open,
|
||||
&.@{tree-prefix-cls}-noline_open {
|
||||
//.antTreeSwitcherIcon();
|
||||
i {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
&.@{tree-prefix-cls}-roots_close,
|
||||
&.@{tree-prefix-cls}-center_close,
|
||||
&.@{tree-prefix-cls}-bottom_close,
|
||||
&.@{tree-prefix-cls}-noline_close {
|
||||
//.antTreeSwitcherIcon();
|
||||
//.ie-rotate(3);
|
||||
&:after {
|
||||
transform: rotate(270deg) scale(0.5);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +122,7 @@
|
|||
>span,
|
||||
>a,
|
||||
>a span {
|
||||
color: #ccc;
|
||||
color: @input-disabled-bg;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<Tree
|
||||
:data.sync="treeData"
|
||||
:checkable="true"
|
||||
:show-checkbox="true"
|
||||
:multiple="true"
|
||||
:on-select="selectFn"
|
||||
:on-check="checkFn"></Tree>
|
||||
|
@ -35,10 +35,10 @@
|
|||
},
|
||||
methods: {
|
||||
selectFn(data){
|
||||
console.log(data);
|
||||
// console.log(data);
|
||||
},
|
||||
checkFn(data){
|
||||
console.log(data);
|
||||
// console.log(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue