Fix: Small bugs

This commit is contained in:
surunzi
2016-05-30 09:50:06 +08:00
parent 04b6b9e0de
commit 36d2af32b4
21 changed files with 69 additions and 110 deletions

View File

@@ -58,34 +58,12 @@ export default class DevTools extends util.Emitter
return this;
}
remove(name)
{
var tool = this._tools[name];
delete this._tools[name];
this._navBar.remove(name);
tool.destroy();
if (tool.active)
{
var keys = util.keys(this._tools);
if (keys.length > 0) this.showTool(keys[0]);
}
return this;
}
get(name)
{
var tool = this._tools[name];
if (tool) return tool;
}
destroy()
{
util.each(this._tools, (tool, key) => this.remove(key));
this._navBar.destroy();
this._$el.remove();
}
showTool(name)
{
if (this._curTool === name) return this;

View File

@@ -22,16 +22,6 @@ export default class NavBar extends util.Emitter
this._$ul.prepend(`<li class="${name}" ontouchstart>${name}</li>`);
this._resetWidth();
}
remove(name)
{
this._len--;
this._$ul.find(`li.${name}`).remove();
this._resetWidth();
}
destroy()
{
this._$el.remove();
}
activeTool(name)
{
var self = this;

View File

@@ -16,8 +16,4 @@ export default class Tool
return this;
}
destroy()
{
this._$el.remove();
}
}