Bread.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <ul class="cli-bread">
  3. <li v-for="(item, index) in breadcrumbArr" :key="index">
  4. <router-link
  5. class="elli"
  6. replace
  7. :to="item.path"
  8. v-text="item.name"
  9. v-title
  10. ></router-link>
  11. <ArrowRight class="cli-bread-curm" v-if="isLast(index)" />
  12. </li>
  13. </ul>
  14. </template>
  15. <script>
  16. import { mapState, mapMutations } from 'vuex'
  17. import ArrowRight from 'meri-design/lib/static/iconSvg/arrow_right.svg'
  18. export default {
  19. data () {
  20. return {}
  21. },
  22. components: { ArrowRight },
  23. computed: {
  24. ...mapState(['breadcrumbArr'])
  25. },
  26. methods: {
  27. ...mapMutations(['changeBreadcrumb']),
  28. isLast (index) {
  29. return index !== this.breadcrumbArr.length - 1
  30. }
  31. }
  32. }
  33. </script>
  34. <style lang="less">
  35. .cli-bread {
  36. word-break: keep-all;
  37. display: flex;
  38. align-items: center;
  39. height: 24px;
  40. line-height: 24px;
  41. width: 100%;
  42. overflow: hidden;
  43. li {
  44. display: flex;
  45. align-items: center;
  46. justify-content: center;
  47. a {
  48. color: #8d9399;
  49. overflow: hidden;
  50. text-overflow: ellipsis;
  51. white-space: nowrap;
  52. max-width: 100px;
  53. display: inline-block;
  54. &:not(:last-child):hover {
  55. color: #0091ff;
  56. }
  57. &:last-child {
  58. cursor: default;
  59. color: #1f2429;
  60. }
  61. }
  62. }
  63. &-curm {
  64. margin-left: 4px;
  65. margin-right: 4px;
  66. vertical-align: middle;
  67. width: 8px;
  68. height: 14px;
  69. margin-bottom: 2px;
  70. }
  71. }
  72. </style>