1
0

second-class.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="second-class dir-left-nowrap">
  3. <view class="spring-board" v-if="switchBool">
  4. <view class="ollapse main-right" @click="switchBool = false">
  5. <image src="./image/ollapse.png" class="ollapse-icon"></image>
  6. </view>
  7. <view class="ollapse-view">
  8. <text class="item" v-for="(it, key) in list" :key="key" :class="key === activeIndexTwo ? 'active ' + theme+ '-m-text ' + theme: ''" @click="setNav(it, key)">
  9. {{it.name}}
  10. </text>
  11. </view>
  12. </view>
  13. <scroll-view scroll-x
  14. v-if="!switchBool"
  15. class="left dir-left-nowrap"
  16. >
  17. <view>
  18. <text class="item " v-for="(it, key) in list" :key="key" :class="key === activeIndexTwo ? 'active ' + theme+ '-m-text ' + theme: ''" @click="setNav(it, key)">
  19. {{it.name}}
  20. </text>
  21. </view>
  22. </scroll-view>
  23. <view class="right" v-if="!switchBool" @click="switchBool = true">
  24. <image src="./image/expand.png" class="icon"></image>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name: "second-class",
  31. props: ['list', `activeIndexTwo`, `theme`],
  32. data() {
  33. return {
  34. switchBool: false
  35. }
  36. },
  37. methods: {
  38. setNav(it, key) {
  39. this.$emit('setNav',it, key);
  40. }
  41. }
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. .second-class {
  46. position: relative;
  47. height: #{106upx};
  48. width: #{528upx};
  49. background-color: #ffffff;
  50. }
  51. .left {
  52. width: #{448upx};
  53. white-space: nowrap;
  54. vertical-align: center;
  55. background-color: #ffffff;
  56. line-height: #{106upx};
  57. }
  58. .right {
  59. width: #{80upx};
  60. height: #{106upx};
  61. position: relative;
  62. box-shadow: #{-1upx 0 5upx -5upx} rgba(0, 0, 0, .2);
  63. }
  64. .item {
  65. display: inline-block;
  66. font-size: #{24upx};
  67. height: #{54upx};
  68. line-height: #{54upx};
  69. padding: #{0 20upx};
  70. border: #{1upx} solid #cccccc;
  71. border-radius: #{34upx};
  72. margin-right: #{16upx};
  73. }
  74. .icon {
  75. position: absolute;
  76. top: 50%;
  77. left: 50%;
  78. transform: translate(-50%, -50%);
  79. width: #{56upx};
  80. height: #{56upx};
  81. }
  82. .ollapse {
  83. height: #{106upx};
  84. width: #{528upx};
  85. position: relative;
  86. }
  87. .ollapse-icon {
  88. position: absolute;
  89. top: 50%;
  90. right: #{12upx};
  91. width: #{56upx};
  92. height: #{56upx};
  93. transform: translateY(-50%);
  94. }
  95. .ollapse-view > text {
  96. margin-bottom: #{20upx};
  97. }
  98. .spring-board {
  99. position: absolute;
  100. top: 0;
  101. left: 0;
  102. width: #{528upx};
  103. z-index: 1000;
  104. background-color: #ffffff;
  105. }
  106. .active {
  107. border: #{1rpx} solid;
  108. }
  109. </style>