自定义点击body 退出登录url隐藏
body上 aaaa(){ if(document.getElementById("B").style.display == 'block'){ document.getElementById("B").style.display = 'none'; }else if(document.getElementById("B").style.display === "flex"){ document.getElementById("B").style.display = 'block'; document.getElementById("B").style['padding-left'] = '23%'; document.getElementById("B").style['padding-top'] = '4.5%'; } header里 <div class = 'left'> <img class = 'img' src = '../../../../assets/images/user.png'> <!-- </div> <div class = 'left'> --> <!-- <span class = 'user' id = 'btn' (click)="aaa()">{{user.name}}</span> --> <span class = 'user' id = 'btn' (click)="aaa()">{{user}}</span> </div> <ul id = 'B' class = 'aaa' style = 'display: none'> <li class = 'aaaa' (click)="aaaa()">退出登录</li> </ul>