mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 10:31:20 -08:00
icon 支持自定义元素
This commit is contained in:
1 parent
5d286e5d00
commit
23237c5ed6
3 files changed
+4
-6
No files matched your search
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user