浏览器 地址栏已经变了,但页面就是不刷新。原因是因为有个方法名与绑定的名字大小写没对应上。
doLogin写成了dologout, #¥!#@¥!#@¥!#@¥ 修改一致后OK。
另外有文章说 data方法没写return, 编译没报错,但也是同一现象。
<button @click="doLogin">登录</button>
<button @click="doLogout">退出</button>
</div>
</template>
<script>
export default {
name: "Login",
data () {
return {
username: '',
userpass: ''
}
},
methods: {
doLogin() {
if (this.username=="jjw" && this.userpass=="123456")
this.$router.push("/main");
},
doLogout() {}
}
};
</script>