Page refreshing after replacing the current route in vue js 3( Component getting unmounted and mounted again)

294 views Asked by At

I have been using router.replace method to add the params in my existing url. But the page is getting refreshed and my settings ( setting a value in the dropdown) getting reset. Any solution for this?

I have tried router.replace method and history.replace method.

1

There are 1 answers

1
Romeo AGBODAZE On

Use this router.push()

// literal string path router.push('/users/eduardo')

// object with path router.push({ path: '/users/eduardo' })

// named route with params to let the router build the url router.push({ name: 'user', params: { username: 'eduardo' } })

// with query, resulting in /register?plan=private router.push({ path: '/register', query: { plan: 'private' } })

// with hash, resulting in /about#team router.push({ path: '/about', hash: '#team' })

enter link description here