Skip to content

Commit 9674555

Browse files
committed
v2.1.0
1 parent 92f11b6 commit 9674555

File tree

8 files changed

+232
-76
lines changed

8 files changed

+232
-76
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Release Notes
2+
3+
## v2.1.0
4+
5+
(2017-11-23)
6+
7+
### Added
8+
9+
- 新增配置选项`idsWithParent`,复选是否包含目录
10+
- 新增`depthOpen`,初始化展开层级
11+
- 新增`v-model`双向绑定复选选项ids
12+
13+
### Changed
14+
15+
- 配置项`checkedIds`不再使用

README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ treeData示例
9999
components: { VueTree },
100100
data () {
101101
return {
102-
// 复选ids
102+
// 复选ids,可传入id数组作为初始选中状态,如[3,4,8]
103103
checkedIds: [],
104104
// tree数据
105105
treeData: Tree.data,
@@ -163,33 +163,59 @@ treeData示例
163163
options: {
164164
// String,节点显示字段
165165
itemName: 'name',
166+
166167
// Boolean,是否显示添加子节点按钮
167168
addItem: true,
169+
168170
// Boolean,是否显示选择框
169171
checkbox: true,
170-
// Array,初始化时选中id
172+
173+
// Array,初始化时选中id (v2.1以后不推荐使用,v3.0将废弃),替代方法见'#使用示例'章节
171174
checkedIds: [],
175+
172176
// Boolean,选中时是否展开节点
173177
checkedOpen: true,
178+
174179
// Boolean,目录是否加粗显示
175180
folderBold: true,
181+
176182
// String,展开按钮(默认依赖font-awesome)
177183
openClass: 'fa fa-plus-square text-info',
184+
178185
// String,收缩按钮(默认依赖font-awesome)
179186
closeClass: 'fa fa-minus-square text-danger',
187+
180188
// String,添加节点按钮(默认依赖font-awesome)
181189
addClass: 'fa fa-plus text-danger',
190+
182191
// Boolean,是否显示编辑按钮
183192
showEdit: true,
193+
184194
// Boolean,是否显示删除按钮
185195
showDelete: true,
196+
186197
// String,编辑按钮(默认依赖font-awesome)
187198
editClass: 'fa fa-edit',
199+
188200
// String,删除按钮(默认依赖font-awesome)
189201
deleteClass: 'fa fa-trash-o'
202+
203+
// (v2.1新增) Boolean,获取复选项目是否包含目录,默认`true`,如果只获取叶子节点设置为`false`
204+
idsWithParent: true
205+
206+
// (v2.1新增) Number,初始化时展开层级,根节点为0,默认0
207+
depthOpen: 0
190208
}
191209
```
192-
> 注意:默认设置使用了`font-awesome`的图标,以及`bootstrap`的情景颜色,如果你继续使用默认设置,请引入这两个`css`库
210+
> 注意:默认设置使用了`font-awesome`的图标,
211+
如果你继续使用默认设置,请引入这个`css`库
212+
213+
## 如何获取复选数据?
214+
215+
自v2.1起,不再从options.checkedIds获取复选数据,
216+
而是使用`v-model="checkedIds"`获取复选id.
217+
218+
> 默认情况下获取的ids是包含所有上级目录的,如果你想获取只包含叶子节点的ids,设置`options.idsWithParent`为`false`
193219
194220
## 事件
195221
@@ -203,6 +229,7 @@ options: {
203229
204230
```html
205231
<vue-tree
232+
v-model="ids"
206233
:tree-data="treeData"
207234
:options="options"
208235
@add-a-child="addAChild"

0 commit comments

Comments
 (0)