MainNavbarLink.vue 885 字节
Newer Older
D
DCloud_LXH 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
<template>
  <div
    v-if="show"
    class="main-navbar-link"
  >
    <DropdownLink
      v-if="item.type === 'links'"
      :item="item"
    />
    <NavLink
      v-else
      :item="item"
    />
  </div>
</template>

<script>
import DropdownLink from '@theme/components/DropdownLink.vue'
import NavLink from '@theme/components/NavLink.vue'

export default {
  name: 'MainNavbarLink',

  components: {
    DropdownLink,
    NavLink
  },

  props: {
    item: {
      type: Object,
      default: () => ({})
    }
  },

  computed: {
    show() {
      return this.item.type === 'link' 
        ? this.item.link
        : this.item.type === 'links'
          ? !!this.item.items.length
          : false
    }
  }
}
</script>

<style lang="stylus" scope>
.main-navbar-link a
 color inherit

@media (max-width: $MQMobile)
 ul
  list-style none
  a
    padding-top 0 !important
</style>