A
A
Alexander Savenko2018-07-13 19:08:50
Vue.js
Alexander Savenko, 2018-07-13 19:08:50

Vue router and clicking on the same link does not cause the component to update. How to win?

Hello!
The user comes to the page by clicking on: For example, the user fills out the form and realizes that he made a mistake and clicks on this link again, but the page will not reload (the component will not be reinitialized, since the address has not changed in the browser address bar) How to win ? It is necessary that the form is always cleared and as if the page was visited for the first time. Thanks in advance!
<router-link to="/big-form">Big form</router-link>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex806, 2018-07-16
@Alex806

If I understand the question correctly, then there are 2 ways to reset the form
: 1. either use the standard 2. Either bind the @click event to your link, and manually refresh the page in the function, that is<input type="reset">

<router-link to="/big-form" @click="resetForm"></router-link>

... 

methods: {
     resetForm(){
         this.$router.push('/big-form')
     }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question