添加设置控制器

This commit is contained in:
Harvey Zack committed 2018-11-02 15:04:16 +08:00
1 parent 711cf5684a
commit 9eab1ed6c0
24 files changed
+297 -119

No files matched your search

+18 -1
View File
@@ -1,9 +1,26 @@
import { append, tooltip, setStyle } from '../utils';
import icons from '../icons';
export default class Setting {
constructor(option) {
this.option = option;
}
apply(art) {
this.art = art;
const { $control } = this.option;
const { events: { proxy }, i18n, setting } = art;
this.$setting = append($control, icons.setting);
tooltip(this.$setting, i18n.get('Show setting'));
proxy($control, 'click', () => {
if (setting.isOpen) {
setting.hide();
setStyle(this.$setting, 'opacity', '1');
tooltip(this.$setting, i18n.get('Show setting'));
} else {
setting.show();
setStyle(this.$setting, 'opacity', '0.8');
tooltip(this.$setting, i18n.get('Hide setting'));
}
});
}
}