mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 10:31:20 -08:00
提取共用方法
This commit is contained in:
1 parent
48ade99047
commit
7a84c262da
45 files changed
+242
-257
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { addClass, removeClass } from './utils';
|
||||
|
||||
export default class Notice {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
@@ -7,7 +9,7 @@ export default class Notice {
|
||||
show(msg, autoHide = true, time = 1000) {
|
||||
const { $player, $noticeInner } = this.art.template;
|
||||
this.state = true;
|
||||
$player.classList.add('artplayer-notice-show');
|
||||
addClass($player, 'artplayer-notice-show');
|
||||
$noticeInner.innerHTML = msg instanceof Error ? msg.message.trim() : msg;
|
||||
clearTimeout(this.timer);
|
||||
if (autoHide) {
|
||||
@@ -21,7 +23,7 @@ export default class Notice {
|
||||
hide() {
|
||||
const { $player } = this.art.template;
|
||||
this.state = false;
|
||||
$player.classList.remove('artplayer-notice-show');
|
||||
removeClass($player, 'artplayer-notice-show');
|
||||
this.art.emit('notice:hide');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user