This commit is contained in:
啊俊
2021-07-17 20:07:56 +08:00
parent c1e741dad6
commit 46dc7eb69e

View File

@@ -52,7 +52,19 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, reactive, computed, ref, toRefs, toRaw, unref, provide, watch, onMounted, nextTick } from 'vue' import {
defineComponent,
reactive,
computed,
ref,
toRefs,
toRaw,
unref,
provide,
watch,
onMounted,
nextTick
} from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { storage } from '@/utils/Storage' import { storage } from '@/utils/Storage'
import { TABS_ROUTES } from '@/store/mutation-types' import { TABS_ROUTES } from '@/store/mutation-types'
@@ -322,7 +334,7 @@ export default defineComponent({
} }
function scrollNext() { function scrollNext() {
const navWidth = navRef.value.offsetWidth const navWidth = navRef.value.scrollWidth
const containerWidth = navScroll.value.offsetWidth const containerWidth = navScroll.value.offsetWidth
const currentOffset = getCurrentScrollOffset() const currentOffset = getCurrentScrollOffset()
if (navWidth - currentOffset <= containerWidth) return if (navWidth - currentOffset <= containerWidth) return
@@ -336,9 +348,9 @@ export default defineComponent({
} }
function updateNavScroll() { function updateNavScroll() {
if(!navRef.value)return if (!navRef.value) return
const navWidth = (navRef.value.offsetWidth + 32) let navWidth = navRef.value.scrollWidth
const containerWidth = navScroll.value.offsetWidth let containerWidth = navScroll.value.offsetWidth
const currentOffset = getCurrentScrollOffset() const currentOffset = getCurrentScrollOffset()
if (containerWidth < navWidth) { if (containerWidth < navWidth) {
state.scrollable = true state.scrollable = true