登录后将用户名存入缓存:

sessionStorage.setItem('user', param.username)

登出后清除缓存并跳转到登录页面:

loginout(){
            this.$confirm('此操作将注销登录, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                sessionStorage.removeItem("user")
                this.$router.push('/login')
            }).catch(() => {
                this.$message({
                type: 'info',
                message: '已取消操作'
                });
            });
        },
Logo

前往低代码交流专区

更多推荐