get selected values
Opened this issue · 0 comments
gazteaukera commented
I have the following code to populate a vue-treeselect from a json file. I need to save the options that the user has selected in localStorage, and get them selected again when the page is reloaded.
Vue.component("treeselect", VueTreeselect.Treeselect);
var tree = new Vue({
el: "#app",
data: {
value: null,
clearOnSelect: true,
closeOnSelect: true,
flat: true,
sortValueBy: 'ORDER_SELECTED',
options: [],
},
methods: {
normalizer: function(node) {
return {
id: node.id,
label: node.label,
children: node.children,
};
},
},
mounted() {
let vm = this;
$.getJSON("/categories.json", function(json) {
vm.options = json;
});
},
});