icon 支持自定义元素

This commit is contained in:
Harvey Zack committed 2019-05-07 08:27:16 +08:00
1 parent 5d286e5d00
commit 23237c5ed6
3 files changed
+4 -6

No files matched your search

+2 -3
View File
@@ -1,4 +1,4 @@
import { errorHandle } from '../utils';
import { append } from '../utils';
import loading from './loading.svg';
import state from './state.svg';
import play from './play.svg';
@@ -37,11 +37,10 @@ export default class Icons {
);
Object.keys(icons).forEach(key => {
errorHandle(typeof icons[key] === 'string', 'Custom icon values ​​only support string types.');
const icon = document.createElement('i');
icon.classList.add('art-icon');
icon.classList.add(`art-icon-${key}`);
icon.innerHTML = icons[key];
append(icon, icons[key]);
this[key] = icon;
});
}