添加Demo自适应

This commit is contained in:
Harvey Zack committed 2018-11-21 16:05:09 +08:00
1 parent e9d7c0cfdc
commit f75e01be3b
8 files changed
+65 -13

No files matched your search

+18 -1
View File
@@ -1,4 +1,4 @@
import { insertByIndex } from '../utils';
import { insertByIndex, setStyle } from '../utils';
import Fullscreen from './fullscreen';
import FullscreenWeb from './fullscreenWeb';
import Pip from './pip';
@@ -120,6 +120,7 @@ export default class Controls {
const $control = document.createElement('div');
$control.classList.value = `art-control art-control-${name}`;
this.mount(option.position, $control, option.index || id);
this.commonMethod(control, $control);
control.apply && control.apply(this.art, $control);
callback && callback($control);
this[name] = control;
@@ -143,6 +144,22 @@ export default class Controls {
}
}
commonMethod(control, $control) {
Object.defineProperty(control, 'hide', {
value: () => {
setStyle($control, 'display', 'none');
this.art.emit('control:hide', $control);
}
});
Object.defineProperty(control, 'show', {
value: () => {
setStyle($control, 'display', 'block');
this.art.emit('control:show', $control);
}
});
}
show() {
const { $player } = this.art.refs;
$player.classList.add('artplayer-controls-show');