update docs

This commit is contained in:
Harvey Zack committed 2023-05-06 09:52:01 +08:00
1 parent 2749d50209
commit 550aa0e7f2
95 files changed
+1734 -1828

No files matched your search

+7 -22
View File
@@ -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);
},
});
}