Skip to content

Commit

Permalink
refactor: hide jump to comment if comment is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyxguo committed Aug 11, 2023
1 parent 9b0db10 commit 8372e21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Sidebar/src/Navigator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<SvgIcon class="inline-block text-3xl" icon-class="back-to-top" />
</li>
<li
v-if="enabledPlugin"
class="flex justify-center py-3 w-full hover:opacity-50 hover:text-ob transition-all cursor-pointer"
@click="jumpToComments"
data-dia="jump-to-comment"
Expand All @@ -26,17 +27,19 @@
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import { computed, defineComponent, ref } from 'vue'
import { useRouter } from 'vue-router'
import SvgIcon from '@/components/SvgIcon/index.vue'
import useJumpToEle from '@/hooks/useJumpToEle'
import useCommentPlugin from '@/hooks/useCommentPlugin'
export default defineComponent({
name: 'Navigator',
components: { SvgIcon },
setup() {
const router = useRouter()
const { jumpToEle } = useJumpToEle()
const { enabledCommentPlugin } = useCommentPlugin()
const backToTop = () => {
window.scrollTo({
Expand All @@ -54,6 +57,7 @@ export default defineComponent({
}
return {
enabledPlugin: computed(() => enabledCommentPlugin.value.plugin !== ''),
goBack,
backToTop,
jumpToComments
Expand Down

0 comments on commit 8372e21

Please sign in to comment.