notice-server-tab.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view class="tabList">
  3. <view
  4. v-for="item in tabList"
  5. :key="item.type"
  6. class="tab"
  7. @click="changeAct(item)"
  8. :class="activeLink === item.type ? 'active' : ''"
  9. >
  10. {{ item.value }}
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. value: {
  18. type: String,
  19. default: () => ''
  20. }
  21. },
  22. data() {
  23. return {
  24. tabList: [
  25. {
  26. type: '',
  27. value: '机构访问通知'
  28. },
  29. {
  30. type: '1',
  31. value: '内容库访问通知'
  32. }
  33. ],
  34. activeLink: ''
  35. }
  36. },
  37. methods: {
  38. changeAct(item) {
  39. this.activeLink = item.type
  40. this.$emit('input', this.activeLink)
  41. }
  42. }
  43. }
  44. </script>
  45. <style scoped lang="scss">
  46. .tabList {
  47. display: flex;
  48. position: sticky;
  49. top: 0;
  50. left: 24rpx;
  51. align-items: center;
  52. z-index: 999;
  53. .tab {
  54. background-color: #fff;
  55. white-space: nowrap;
  56. text-align: center;
  57. flex: 1;
  58. padding: 10rpx;
  59. margin-bottom: 24rpx;
  60. font-size: 28rpx;
  61. font-weight: bold;
  62. box-sizing: border-box;
  63. &.active {
  64. color: #ff5800;
  65. border-color: 1px solid #ff5800;
  66. }
  67. }
  68. }
  69. </style>