Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get selected values #529

Open
gazteaukera opened this issue Jun 8, 2023 · 0 comments
Open

get selected values #529

gazteaukera opened this issue Jun 8, 2023 · 0 comments

Comments

@gazteaukera
Copy link

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;
    });
},

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant