You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
790 B

8 months ago
4 months ago
8 months ago
  1. <template>
  2. <view class="navs">
  3. <view class="nav" @click="changeNav(item.id)" :class="{active: currentNav==item.id}" v-for="(item,index) in navData" :key="index">{{ item.text }}</view>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. props: ['navData', 'currentNav'],
  9. methods: {
  10. changeNav(id) {
  11. console.log(id)
  12. this.$emit('changeNav', id)
  13. }
  14. }
  15. }
  16. </script>
  17. <style lang="scss" scoped>
  18. .navs {
  19. display: flex;
  20. width: 100%;
  21. height: 72rpx;
  22. background: #FFFFFF;
  23. border-radius: 16rpx;
  24. .nav {
  25. flex: 1;
  26. text-align: center;
  27. line-height: 72rpx;
  28. color: #ADADAD;
  29. font-size: 28rpx;
  30. &.active {
  31. background: rgba(25,137,250,0.1);
  32. border-radius: 16rpx;
  33. border: 2rpx solid #1989FA;
  34. color: $themC;
  35. font-weight: 600;
  36. }
  37. }
  38. }
  39. </style>