mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 01:21:20 -08:00
update docs
This commit is contained in:
1 parent
2749d50209
commit
550aa0e7f2
95 files changed
+1734
-1828
No files matched your search
@@ -1,32 +1,17 @@
|
||||
import { setStyle, hasClass, addClass, removeClass, def } from '../utils';
|
||||
import { setStyle, def } from '../utils';
|
||||
|
||||
export default function autoHeightMix(art) {
|
||||
const {
|
||||
option,
|
||||
template: { $container, $video },
|
||||
} = art;
|
||||
|
||||
const heightCache = $container.style.height;
|
||||
|
||||
def(art, 'autoHeight', {
|
||||
get() {
|
||||
return hasClass($container, 'art-auto-height');
|
||||
},
|
||||
set(value) {
|
||||
if (value) {
|
||||
const { clientWidth } = $container;
|
||||
const { videoHeight, videoWidth } = $video;
|
||||
const height = videoHeight * (clientWidth / videoWidth);
|
||||
setStyle($container, 'height', height + 'px');
|
||||
addClass($container, 'art-auto-height');
|
||||
art.autoSize = option.autoSize;
|
||||
art.emit('autoHeight', height);
|
||||
} else {
|
||||
setStyle($container, 'height', heightCache);
|
||||
removeClass($container, 'art-auto-height');
|
||||
art.autoSize = option.autoSize;
|
||||
art.emit('autoHeight');
|
||||
}
|
||||
value() {
|
||||
const { clientWidth } = $container;
|
||||
const { videoHeight, videoWidth } = $video;
|
||||
const height = videoHeight * (clientWidth / videoWidth);
|
||||
setStyle($container, 'height', height + 'px');
|
||||
art.emit('autoHeight', height);
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user