vue.js - vue routing with extra? -


i have wired problem:

i using vue-route, login link is: http://localhost/#!/login

i have <form> login:

<button @click="submit()">login</button> 

the submit button call login function, use vue-resource make api call, stop @ $http.post below:

context.$http.post(login_url, creds).then(function (res) { 

it direct : http://localhost/?#!/login <- ?

this happen once when login loaded, sub sequence work correctly.


if take out the form, problem go away:

<form class="form"> 

is possible you're not preventing default action of button?

buttons, when defined in context of form, are automatically assumed submit buttons.

you can fix adding type="button" button:

<button type="button" @click="submit()">login</button> 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -