app-head-navigation.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <scroll-view scroll-x class="app-head-navigation dir-left-nowrap cross-center">
  3. <text class="head-text" :class="item.active === true ? 'app-active ' + theme + '-m-back ' + theme : ''"
  4. v-for="(item, index) in list"
  5. :key="index"
  6. @click="active(item)">
  7. {{item.name}}
  8. </text>
  9. </scroll-view>
  10. </template>
  11. <script>
  12. export default {
  13. name: 'app-head-navigation',
  14. props: {
  15. list: {
  16. type: Array,
  17. default: function() {
  18. return [];
  19. }
  20. },
  21. theme: String
  22. },
  23. methods: {
  24. active(item) {
  25. this.$emit('click', item);
  26. }
  27. }
  28. }
  29. </script>
  30. <style scoped lang="scss">
  31. .app-head-navigation {
  32. width: #{750rpx};
  33. height: #{100rpx};
  34. line-height: #{100rpx};
  35. border-top: #{1rpx} solid #e2e2e2;
  36. border-bottom: #{1rpx} solid #e2e2e2;
  37. padding: #{0 24rpx};
  38. white-space:nowrap;
  39. background-color: #ffffff;
  40. .head-text {
  41. display: inline-block;
  42. height: #{56rpx};
  43. padding: 0 #{20rpx};
  44. font-size: #{28rpx};
  45. line-height: #{56rpx};
  46. border-radius: #{28rpx};
  47. margin-right: #{32rpx};
  48. white-space:nowrap;
  49. }
  50. }
  51. .app-active {
  52. color: white;
  53. }
  54. </style>