breadcrumb.vue 630 B

12345678910111213141516171819202122232425262728293031323334
  1. <template>
  2. <div class="el-breadcrumb" aria-label="Breadcrumb" role="navigation">
  3. <slot></slot>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'ElBreadcrumb',
  9. props: {
  10. separator: {
  11. type: String,
  12. default: '/'
  13. },
  14. separatorClass: {
  15. type: String,
  16. default: ''
  17. }
  18. },
  19. provide() {
  20. return {
  21. elBreadcrumb: this
  22. };
  23. },
  24. mounted() {
  25. const items = this.$el.querySelectorAll('.el-breadcrumb__item');
  26. if (items.length) {
  27. items[items.length - 1].setAttribute('aria-current', 'page');
  28. }
  29. }
  30. };
  31. </script>