[Vuejs]-Vue 3 – Best way of using URL parameters for bookmark (like filtering)

0👍

It dependes….maybe is better to create an api that refresh your table…

In this way you pass the parameter to the api that will get you the book array, and in this way you refresh your content…

In this way you will have a url like:

domain.net/page?f=1p=filterparamete

Or you can use vue dynamic routing

/page/:filter/:filter_value

But in this case you shold have a fixed url structure in case of multiple filter setting..

In any case the first way is the most easy and scalable way…

0👍

You can use the query-string lib to parse URL parameters and then just filter items by params

const queryString = require('query-string');
console.log(location.search); // '?status=pending'
const parsedParams = queryString.parse(location.search);
console.log(parsedParams) // { status: 'pending' };

Leave a comment