mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
压缩字符
This commit is contained in:
1 parent
2df60a78ff
commit
5f40463713
40 files changed
+385
-481
No files matched your search
@@ -3,26 +3,17 @@ import { addClass, removeClass } from './utils';
|
||||
export default class Notice {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
this.time = 1000;
|
||||
this.timer = null;
|
||||
}
|
||||
|
||||
show(msg, autoHide = true, time = 1000) {
|
||||
set show(msg) {
|
||||
const { $player, $noticeInner } = this.art.template;
|
||||
$noticeInner.innerHTML = msg instanceof Error ? msg.message.trim() : msg;
|
||||
clearTimeout(this.timer);
|
||||
if (autoHide) {
|
||||
this.timer = setTimeout(() => {
|
||||
this.hide();
|
||||
}, time);
|
||||
}
|
||||
$noticeInner.innerText = msg instanceof Error ? msg.message.trim() : msg;
|
||||
addClass($player, 'art-notice-show');
|
||||
this.art.emit('notice:toggle', true);
|
||||
}
|
||||
|
||||
hide() {
|
||||
const { $player, $noticeInner } = this.art.template;
|
||||
$noticeInner.innerHTML = '';
|
||||
removeClass($player, 'art-notice-show');
|
||||
this.art.emit('notice:toggle', true);
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
removeClass($player, 'art-notice-show');
|
||||
}, this.time);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user