qTab.vue 696 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <div class="tab">
  3. <div class="tab-header">
  4. <div
  5. v-for="item in header"
  6. :key="item.key"
  7. :class="`header-menu ${item.key===nowKey?'menu-now':''}`"
  8. >
  9. {{item.text}}
  10. </div>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: "qTab",
  17. props:{
  18. header: {
  19. default(){
  20. return []
  21. }
  22. }
  23. },
  24. data(){
  25. return {
  26. nowKey: this.header.length?this.header[0].key:''
  27. }
  28. }
  29. }
  30. </script>
  31. <style scoped>
  32. .tab{
  33. width: 100%;
  34. height: auto;
  35. }
  36. .tab-header{
  37. width: 100%;
  38. height: 35px;
  39. display: flex;
  40. }
  41. .tab-header .header-menu{
  42. padding: 5px 15px;
  43. border-radius: 3px;
  44. }
  45. </style>