app-head-nav-list.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <scroll-view scroll-x class="app-head-nav-list">
  3. <text class="app-item" v-for="(item, index) in catList"
  4. :key="index"
  5. :style="{'background-color': cat_id == item.id && theme.key != 'a' ? theme.background : '','color': cat_id == item.id ? '#fff' :''}"
  6. :class="cat_id == item.id && theme.key == 'a' ? 'default-item' : ''"
  7. @click="active(item.id)"
  8. >{{item.name}}</text>
  9. </scroll-view>
  10. </template>
  11. <script>
  12. export default {
  13. name: "app-head-nav-list",
  14. props: [`catList`, `cat_id`, `theme`],
  15. methods: {
  16. active(id) {
  17. this.$emit('click', id);
  18. },
  19. },
  20. }
  21. </script>
  22. <style scoped lang="scss">
  23. .app-head-nav-list {
  24. width: #{750rpx};
  25. height: #{88rpx};
  26. white-space: nowrap;
  27. background: #ffffff;
  28. .app-item {
  29. display: inline-block;
  30. height: #{56rpx};
  31. line-height: #{56rpx};
  32. font-size: #{28rpx};
  33. text-align: center;
  34. color: #666666;
  35. margin: #{16rpx} #{23rpx};
  36. border-radius: #{30rpx};
  37. padding: 0 #{24rpx};
  38. }
  39. .default-item {
  40. background: linear-gradient(140deg, #ffa360, #ff5c5c);
  41. }
  42. }
  43. </style>