优化icon

This commit is contained in:
Harvey committed 2020-09-18 14:10:57 +08:00
1 parent 3861770105
commit 3a545ae5e6
7 files changed
+159 -139

No files matched your search

+11 -7
View File
@@ -1,4 +1,4 @@
import { append } from '../utils';
import { append, def, addClass } from '../utils';
import loading from './loading.svg';
import state from './state.svg';
import play from './play.svg';
@@ -30,12 +30,16 @@ export default class Icons {
...art.option.icons,
};
Object.keys(icons).forEach(key => {
const icon = document.createElement('i');
icon.classList.add('art-icon');
icon.classList.add(`art-icon-${key}`);
append(icon, icons[key]);
this[key] = icon;
Object.keys(icons).forEach((key) => {
def(this, key, {
get: () => {
const icon = document.createElement('i');
addClass(icon, 'art-icon');
addClass(icon, `art-icon-${key}`);
append(icon, icons[key]);
return icon;
},
});
});
}
}