|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="table-loop" ref="tableLoop">
|
|
|
- <div class="thead">
|
|
|
+ <div class="thead" ref="thead">
|
|
|
<div class="td index">排名</div>
|
|
|
<div
|
|
|
class="td"
|
|
@@ -13,7 +13,7 @@
|
|
|
</div>
|
|
|
<swiper
|
|
|
:key="swiperKey"
|
|
|
- :style="{ height: 36 * rowNum + 'px' }"
|
|
|
+ :style="{ height: 36 * rowNum + 'px', width: swiperWidth + 'px' }"
|
|
|
:modules="modules"
|
|
|
direction="vertical"
|
|
|
:slides-per-view="rowNum"
|
|
@@ -69,6 +69,16 @@ const tbodyHeight = ref(1);
|
|
|
const rowNum = computed(() => {
|
|
|
return parseInt(tbodyHeight.value / 36);
|
|
|
});
|
|
|
+const swiperWidth = ref(0);
|
|
|
+const thead = ref();
|
|
|
+onMounted(() => {
|
|
|
+ let w = 0;
|
|
|
+ for (let i = 0; i < thead.value.children.length; i++) {
|
|
|
+ let node = thead.value.children[i];
|
|
|
+ w += node.offsetWidth;
|
|
|
+ }
|
|
|
+ swiperWidth.value = w;
|
|
|
+});
|
|
|
|
|
|
onMounted(() => {
|
|
|
tbodyHeight.value = tableLoop.value.offsetHeight - 46;
|