|
@@ -31,7 +31,7 @@
|
|
|
/>
|
|
|
</el-carousel-item>
|
|
|
</el-carousel>
|
|
|
- <div class="container-box">
|
|
|
+ <div class="container-box" :style="{ height: elementHeight + 'px' }">
|
|
|
<ul
|
|
|
ref="container"
|
|
|
class="view-list-bottom"
|
|
@@ -68,12 +68,12 @@ export default {
|
|
|
data: getVideoData(),
|
|
|
curVideoIndex: 0,
|
|
|
elementWidth: 0,
|
|
|
- elementHeight: 0,
|
|
|
+ elementHeight: 139,
|
|
|
viewTopBottomBtn: false,
|
|
|
fileLen: 0,
|
|
|
translateY: 0,
|
|
|
elementID: '',
|
|
|
- observersMap: {},
|
|
|
+ videoObserversMap: {},
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -82,8 +82,16 @@ export default {
|
|
|
this.fileLen = val.file_list.length;
|
|
|
if (this.fileLen > 0 && this.data.property.view_method === 'list') {
|
|
|
const ele = this.$refs.videoAreaBox;
|
|
|
- this.elementWidth = ele.clientWidth;
|
|
|
- this.elementHeight = ele.clientHeight;
|
|
|
+ const sn_position = this.data.property.sn_position;
|
|
|
+ // 序号在左和右补齐序号高度,去掉padding(8*2)
|
|
|
+ if (sn_position.includes('left') || sn_position.includes('right')) {
|
|
|
+ this.elementWidth = ele.clientWidth - 16;
|
|
|
+ this.elementHeight = ele.clientHeight + 30;
|
|
|
+ } else {
|
|
|
+ this.elementWidth = ele.clientWidth;
|
|
|
+ this.elementHeight = ele.clientHeight;
|
|
|
+ }
|
|
|
+
|
|
|
const mainEle = this.$refs.videoArea;
|
|
|
// 检查元素是否包含已知的类名
|
|
|
mainEle.classList.forEach((className) => {
|
|
@@ -110,20 +118,27 @@ export default {
|
|
|
const canvasElement = document.querySelector('.canvas');
|
|
|
if (!canvasElement) return;
|
|
|
const instanceName = `observer_${this.elementID}`;
|
|
|
- this.observersMap[instanceName] = new ResizeObserver((entries) => {
|
|
|
+ this.videoObserversMap[instanceName] = new ResizeObserver((entries) => {
|
|
|
if (!this.getDragStatus()) return;
|
|
|
for (let entry of entries) {
|
|
|
window.requestAnimationFrame(() => {
|
|
|
- this.elementWidth = entry.contentRect.width;
|
|
|
- this.elementHeight = entry.contentRect.height;
|
|
|
+ const sn_position = this.data.property.sn_position;
|
|
|
+ // 序号在上方和下方减去序号高度,在左右去掉padding(8*2)
|
|
|
+ if (sn_position.includes('top') || sn_position.includes('bottom')) {
|
|
|
+ this.elementWidth = entry.contentRect.width;
|
|
|
+ this.elementHeight = entry.contentRect.height - 30;
|
|
|
+ } else {
|
|
|
+ this.elementWidth = entry.contentRect.width - 16;
|
|
|
+ this.elementHeight = entry.contentRect.height;
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- this.observersMap[instanceName].observe(this.$el);
|
|
|
+ this.videoObserversMap[instanceName].observe(this.$el);
|
|
|
});
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- Object.values(this.observersMap).forEach((observer) => {
|
|
|
+ Object.values(this.videoObserversMap).forEach((observer) => {
|
|
|
observer.disconnect();
|
|
|
});
|
|
|
},
|
|
@@ -167,6 +182,7 @@ export default {
|
|
|
this.viewTopBottomBtn = true;
|
|
|
} else {
|
|
|
this.viewTopBottomBtn = false;
|
|
|
+ this.translateY = 0;
|
|
|
}
|
|
|
},
|
|
|
// 滚动图片列表
|