mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 21:31:20 -08:00
add useSSR
This commit is contained in:
1 parent
7eeba80319
commit
d5b4851a8f
9 files changed
+306
-44
No files matched your search
@@ -4,13 +4,18 @@ import Component from './utils/component';
|
||||
export default class Info extends Component {
|
||||
constructor(art) {
|
||||
super(art);
|
||||
|
||||
this.art = art;
|
||||
this.name = 'info';
|
||||
if (this.art.template.$info) {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
const {
|
||||
template: { $infoPanel, $infoClose, $video },
|
||||
events: { proxy },
|
||||
} = art;
|
||||
} = this.art;
|
||||
|
||||
proxy($infoClose, 'click', () => {
|
||||
this.show = false;
|
||||
@@ -19,12 +24,12 @@ export default class Info extends Component {
|
||||
let timer = null;
|
||||
const types = queryAll('[data-video]', $infoPanel);
|
||||
|
||||
art.on('destroy', () => {
|
||||
this.art.on('destroy', () => {
|
||||
clearTimeout(timer);
|
||||
});
|
||||
|
||||
function loop() {
|
||||
types.forEach(item => {
|
||||
types.forEach((item) => {
|
||||
const value = $video[item.dataset.video];
|
||||
item.innerText = typeof value === 'number' ? value.toFixed(2) : value;
|
||||
});
|
||||
@@ -33,7 +38,7 @@ export default class Info extends Component {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
art.on('info', value => {
|
||||
this.art.on('info', (value) => {
|
||||
clearTimeout(timer);
|
||||
if (value) {
|
||||
loop();
|
||||
|
||||
Reference in new issue
Block a user