## 退出登录
```
// 退出登录
router.post('/logout', function(req, res, next) {
    //清除 cookie
    把userId的值变为空值
    res.cookie("userId", "", {
        path: '/',
        maxAge: -1   把时间变为负数
    })

    res.json({
        status: 0,
        msg: '',
        result: '退出成功'
    })
})
```


## 前台操作

### dom操作
```
    <div class="topbar-info J_userInfo" id="ECS_MEMBERZONE">
        <span v-text="nickName" > </span>
        <a class="link"  rel="nofollow" v-if="!nickName" @click="loginModalFlag = true">登录</a>
        <span class="sep" v-if="nickName">|</span>
        在这点击按钮执行 logout 函数
        <a class="link" @click="logout" v-if="nickName" rel="nofollow">退出</a>
    </div>

```

### js操作
```
    logout(){
        axios.post('/users/logout').then(result=>{
            let res = result.data;
            this.nickName = '';  //把nickName 清空
            console.log(res);
        })
    }
```