1.navbar中设置下拉名称
<el-dropdown-menu slot="dropdown" class="user-dropdown">
<router-link to="/">
<el-dropdown-item>
首页
</el-dropdown-item>
</router-link>
<a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/">
<el-dropdown-item>项目地址</el-dropdown-item>
</a>
<a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/">
<el-dropdown-item>修改密码</el-dropdown-item>
</a>
<!-- @nativa修饰符,注册组件的根元素的原生事件 -->
<el-dropdown-item divided @click.native="logout">
<span style="display:block;">登出</span>
</el-dropdown-item>
</el-dropdown-menu>
2.添加登出方法
async logout() {
await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
}
本文暂时没有评论,来添加一个吧(●'◡'●)