优化登录跳转规则
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<el-input placeholder="请输入用户名" v-model="username" clearable>
|
||||
</el-input>
|
||||
<el-input
|
||||
placeholder="请输入密码"
|
||||
v-model="password"
|
||||
show-password
|
||||
></el-input>
|
||||
<el-button
|
||||
class="login-button"
|
||||
type="primary"
|
||||
native-type="submit"
|
||||
@click="handleLogout"
|
||||
>
|
||||
退出
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ChatPage",
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
username: "",
|
||||
password: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
handleLogout() {
|
||||
this.$store.commit("SET_TOKEN", '');
|
||||
this.$store.commit("SET_USERNAME", '');
|
||||
this.$router.push("/login");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user