app-head-nav-list.vue 1016 B

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