多次点击 close和open出现Bug
当多次点击close和open时,UI有明显的“瞬移”。原因是代码中当我们第一次点击open时初始化了对象的style.left,而代码中没有初始化close,我们加上
Sidebar.prototype.close=function(){
console.log('关闭sidebar');
this.el.style.left='0px'; //加这个
this.closeBarEl.style.left='0px';//加这个
this.el.className='sidebar-move-left';
this.closeBarEl.className='closeBar-move-right';
this.state='closed';
};