fold.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="fold">
  3. <ul>
  4. <li :class="{anima:isActive}" @click.stop="showItem(item)" :style="{background:item.color,transitionDelay:`${(i+1)*0.1}s`}" v-for="(item,i) in rawdata" :key="i">
  5. <div>
  6. <span>{{item.name}}</span>
  7. <span>{{item.xuhao}}</span>
  8. </div>
  9. <img v-if="item.sub" :src="require(`@/assets/images/${!item.show?`show_enlarge@2x.png`:`show_narrow@2x.png`}`)" alt="">
  10. <ul @click.stop v-if="item.sub" :style="{maxHeight:item.show?`${item.sub.data.length*70}px`:'0','padding-bottom':item.show?'10px':'0'}">
  11. <li :style="{background:item.sub.bgclr||''}" v-for="(sub,idx) in item.sub.data" :key="idx">
  12. <div @click.stop="showItem(sub)" :class="{bLine:item.bgclr}">
  13. <div>
  14. <span>{{sub.name}}</span>
  15. <span>{{sub.xuhao}}</span>
  16. </div>
  17. </div>
  18. </li>
  19. </ul>
  20. </li>
  21. </ul>
  22. </div>
  23. </template>
  24. <script>
  25. import {data} from './data.js'
  26. import {data as data2} from './data2.js'
  27. import browser from '@/utils/browser'
  28. export default {
  29. props:['isActive'],
  30. data(){
  31. let tt = data.concat(data2)
  32. let temp = tt.filter(item=>{
  33. item.show = false
  34. return !item.isHide
  35. })
  36. return {
  37. rawdata:temp,
  38. isMobile: browser.mobile
  39. }
  40. },
  41. methods:{
  42. goto(url){
  43. this.$router.push({
  44. name:'iframe',
  45. params:{
  46. id: url
  47. }
  48. })
  49. },
  50. showItem(item){
  51. if (!item.sub) {
  52. this.goto(item.url)
  53. return
  54. }
  55. item.show = !item.show
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="less" scoped>
  61. .fold{
  62. width: 320px;
  63. min-height: 70px;
  64. max-height: 600px;
  65. background: linear-gradient(180deg, #00D3F6 0%, #234ED8 100%);
  66. box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  67. opacity: 1;
  68. padding: 15px;
  69. border-radius: 4px;
  70. overflow: auto;
  71. .mb-top{
  72. position: relative;
  73. border-bottom: 1px solid #ECECEC;
  74. margin-bottom: 10px;
  75. padding: 10px 0 20px;
  76. font-weight: bold;
  77. >img{
  78. position: absolute;
  79. transform: translateX(-50%);
  80. left: 50%;
  81. top: 0px;
  82. }
  83. }
  84. >ul{
  85. color: #FFFFFF;
  86. height: 100%;
  87. overflow: hidden;
  88. >li{
  89. padding: 0 15px;
  90. line-height: 40px;
  91. border-radius: 4px;
  92. background: #231815;
  93. position: relative;
  94. margin-bottom: 10px;
  95. overflow: hidden;
  96. transform: translateX(150%);
  97. transition: none;
  98. >div{
  99. display: flex;
  100. justify-content: space-between;
  101. }
  102. >img{
  103. position: absolute;
  104. top: 18px;
  105. right: 15px;
  106. width: 10px;
  107. }
  108. >ul{
  109. max-height: 0;
  110. transition: all 0.3s ease;
  111. >li{
  112. line-height: 36px;
  113. background: rgba(255, 255, 255, 0.2);
  114. border-radius: 4px;
  115. padding: 0 10px;
  116. font-size: 14px;
  117. overflow: hidden;
  118. cursor: pointer;
  119. &:not(:last-of-type){
  120. margin-bottom: 10px;
  121. }
  122. >div{
  123. >div{
  124. display: flex;
  125. justify-content: space-between;
  126. &:not(:last-of-type){
  127. border-bottom: 1px solid rgba(255,255,255,0.4);
  128. }
  129. }
  130. }
  131. .bLine{
  132. >div{
  133. &:not(:last-of-type){
  134. border-bottom: 1px solid rgba(0,0,0,0.1);
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. .anima{
  142. transform: translateX(0);
  143. transition: ease .3s transform;
  144. }
  145. }
  146. }
  147. @media screen and (max-width: 500px) {
  148. .fold{
  149. max-height: calc(100vh - 70px);
  150. }
  151. }
  152. </style>