vue js navigate to url with question mark

The form is getting submitted as the button you have provided in the form has type="submit" which is the default behaviour of a button present inside form even if you do not add the attribute type="button"

So replace the type submit to button o prevent form submission like this:

<button @click="login" type="button" class="btn btn-success">Submit</button>

I just faced the same issue, and the provided solution did not worked for me (Vue 2.5.17).

I had to add a modifier to the @click event to prevent the default behavior:

<button class="btn btn-primary" @click.prevent="login">Login</button>

Tags:

Vue.Js