window.location.href失效原因
<button @click="login()" type="submit">登录</button>
按钮类型是submit,因为submit是提交from表单的,提交了form表单跳转就失效了
改成:
type="button"
写了from表单还不想from表单提交,就要注意按钮的类型了
<button @click="login()" type="submit">登录</button>
按钮类型是submit,因为submit是提交from表单的,提交了form表单跳转就失效了
改成:
type="button"
写了from表单还不想from表单提交,就要注意按钮的类型了