Skip to content

Commit f3fcad8

Browse files
authored
Merge pull request #134 from grapoza/fix-initialization-order-selection
Moves the selection initialization to mounted
2 parents 2d8ab32 + 5a125d2 commit f3fcad8

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Yet another Vue treeview component.",
44
"author": "Gregg Rapoza <grapoza@gmail.com>",
55
"license": "MIT",
6-
"version": "1.3.4",
6+
"version": "1.3.5",
77
"browser": "index.js",
88
"repository": {
99
"url": "https://github.com/grapoza/vue-tree",

src/components/TreeView.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@
121121
return this.selectionMode === null ? false : (this.selectionMode === 'multiple').toString();
122122
}
123123
},
124-
created() {
125-
this.$_treeView_enforceSingleSelectionMode();
126-
},
127124
mounted() {
125+
this.$_treeView_enforceSingleSelectionMode();
128126
this.$set(this, 'uniqueId', this.$el.id ? this.$el.id : null);
129127
},
130128
methods: {
@@ -211,7 +209,7 @@
211209
if (this.selectionMode === 'single') {
212210
let alreadyFoundSelected = false;
213211
this.$_treeView_depthFirstTraverse((node) => {
214-
if (node.state.selected === true) {
212+
if (node.state && node.state.selected === true) {
215213
if (alreadyFoundSelected) {
216214
node.state.selected = false;
217215
}

0 commit comments

Comments
 (0)