Skip to content

Commit

Permalink
fix: home page tag sticky overflow to the footer if no footer link
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyxguo committed Aug 22, 2023
1 parent b1ff151 commit 6cb0a86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/Sidebar/src/TagBox.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<Sticky
:stickyTop="32 + 81"
endingElId="footer-link"
:endingElId="endEleId"
dynamicElClass="#sticky-tag-box"
>
<div id="sticky-tag-box" class="sidebar-box">
Expand Down Expand Up @@ -53,11 +53,13 @@ import { TagList, TagItem } from '@/components/Tag'
import { useI18n } from 'vue-i18n'
import SvgIcon from '@/components/SvgIcon/index.vue'
import Sticky from '@/components/Sticky.vue'
import { useAppStore } from '@/stores/app'
export default defineComponent({
name: 'ObTag',
components: { SubTitle, TagList, TagItem, SvgIcon, Sticky },
setup() {
const appStore = useAppStore()
const tagStore = useTagStore()
const { t } = useI18n()
const expand = ref<boolean>(false)
Expand All @@ -73,6 +75,11 @@ export default defineComponent({
onMounted(fetchData)
return {
endEleId: computed(() =>
appStore.themeConfig.footerLinks.data.length > 0
? 'footer-link'
: 'footer'
),
tags: computed(() => {
if (tagStore.isLoaded && tagStore.tags.length === 0) return null
return tagStore.tags
Expand Down
1 change: 1 addition & 0 deletions src/components/Sticky.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export default defineComponent({
if (this.isSticky) {
this.width = this.$el.getBoundingClientRect().width + 'px'
}
this.updateScroll()
}
}
})
Expand Down

0 comments on commit 6cb0a86

Please sign in to comment.