mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
优化DEMO
This commit is contained in:
1 parent
d17104ed3b
commit
dd8397f14e
9 files changed
+48
-22
No files matched your search
@@ -158,7 +158,11 @@ export default class Controls {
|
||||
|
||||
errorHandle(parent, 'Controls option.position can not be empty');
|
||||
this.id += 1;
|
||||
return component(this.art, this, parent, option, callback, 'control');
|
||||
const control = component(this.art, this, parent, option, callback, 'control');
|
||||
if (!(control.$ref.firstElementChild && control.$ref.firstElementChild.tagName === 'I')) {
|
||||
control.$ref.classList.add('art-control-onlyText');
|
||||
}
|
||||
return control;
|
||||
}
|
||||
|
||||
set show(value) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { append } from '../utils';
|
||||
import { append, getStyle } from '../utils';
|
||||
|
||||
export default function quality(controlOption) {
|
||||
return art => ({
|
||||
@@ -6,7 +6,7 @@ export default function quality(controlOption) {
|
||||
mounted: $control => {
|
||||
const {
|
||||
option,
|
||||
events: { proxy },
|
||||
events: { proxy, hover },
|
||||
player,
|
||||
} = art;
|
||||
|
||||
@@ -19,6 +19,10 @@ export default function quality(controlOption) {
|
||||
.join('');
|
||||
const $qualitys = append($control, `<div class="art-qualitys">${qualityList}</div>`);
|
||||
|
||||
hover($control, () => {
|
||||
$qualitys.style.left = `-${getStyle($qualitys, 'width') / 2 - $control.clientWidth / 2}px`;
|
||||
});
|
||||
|
||||
proxy($qualitys, 'click', event => {
|
||||
const index = Number(event.target.dataset.index);
|
||||
const { url, name } = option.quality[index];
|
||||
|
||||
Reference in new issue
Block a user