How does the query parameter in vue relate to the filtering form Synchronize

has a filter form, which is bound to filter , and watch listener calls
this.$router.push ({query:this.filter}) whenever there is a change, reflecting the filter parameters into the url parameter. When opening the URL such as / aquib , the query parameter is reflected on the filter form.

so it falls into an endless cycle,

filter will affect query
query will affect filter

the final filter parameters are subject to url

initial use of vuex, does not need to show filter conditions, no problem. Now it is required to display filter conditions in url mode.
is a bit confused. How to avoid this endless cycle?

Mar.18,2021

how does it end up in an endless loop? Do not understand how you operate;
use computed to calculate query parameters, enter the page to get data according to the parameters, and then use beforeRouteUpdate to get data when the route (parameter) is changed.


url adds a parameter as a distinction, for example: type:0 / / 1 represents the entry from the outside, and 2 represents the

added to the form.
Menu