Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: home page tag sticky overflow to the footer if no footer link #334

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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