L
L
lavezzi12018-02-28 08:37:04
JavaScript
lavezzi1, 2018-02-28 08:37:04

How to store multiple query values?

Hello. It is necessary to implement a tree, something like folders with infinite nesting. So that after reloading the page the tree remains open in the same place as before reloading, I write the current path to query.

onFolderClick(folder) {
        this.$router.push({ path: `/files/${this.folder.id}`, query: { path: folder.key } });
},

One level works out, but if there is another folder in this folder, then the path will be rewritten to a new folder and I will lose nesting and will not be able to show breadcrumbs.
Is it possible to make the path something like this: /files?path=folder1&path=folder2&path=folder3.
Or is this wrong and is there a better way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kalibrov, 2018-02-28
@rework

A node (folder) must have a link to its parent. You can recursively go from the current node to the parent, then to its parent, until you reach the root node and make each node in the branch open.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question