mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
修改switcher逻辑
This commit is contained in:
1 parent
dd1ae0f499
commit
20afbab916
6 files changed
+75
-64
No files matched your search
@@ -160,12 +160,8 @@ export default class Control extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
add(getOption, callback) {
|
||||
add(getOption) {
|
||||
const option = typeof getOption === 'function' ? getOption(this.art) : getOption;
|
||||
errorHandle(
|
||||
['top', 'left', 'right'].includes(option.position),
|
||||
`Control option.position must one of 'top', 'left', 'right'`,
|
||||
);
|
||||
const { $progress, $controlsLeft, $controlsRight } = this.art.template;
|
||||
|
||||
switch (option.position) {
|
||||
@@ -179,21 +175,10 @@ export default class Control extends Component {
|
||||
this.$parent = $controlsRight;
|
||||
break;
|
||||
default:
|
||||
errorHandle(false, `Control option.position must one of 'top', 'left', 'right'`);
|
||||
break;
|
||||
}
|
||||
|
||||
super.add(option, ($ref) => {
|
||||
if (
|
||||
!option.disable &&
|
||||
option.position !== 'top' &&
|
||||
!($ref.firstElementChild && $ref.firstElementChild.tagName === 'I')
|
||||
) {
|
||||
addClass($ref, 'art-control-onlyText');
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback($ref, this, this.art);
|
||||
}
|
||||
});
|
||||
super.add(option);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user