drawer.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="bg-gradual-blue">
  3. <scroll-view scroll-y class="DrawerPage" :class="modalName=='viewModal'?'show':''">
  4. <cu-custom bgColor="bg-gradual-blue" :isBack="true"><block slot="backText">返回</block>
  5. <block slot="content">全屏抽屉</block>
  6. </cu-custom>
  7. <view class='padding margin text-center'>
  8. <view class='cu-btn bg-green lg block shadow radius margin-xl' @tap="showModal" data-target="viewModal">
  9. 打开抽屉
  10. </view>
  11. </view>
  12. <view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg">
  13. <view class="cu-item arrow" v-for="(item,index) in 20" :key="index">
  14. <view class="content">
  15. <text class="cuIcon-github text-grey"></text>
  16. <text class="text-grey">{{index +1}}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view class='padding margin text-center'>
  21. <view class='cu-btn bg-green lg block shadow radius margin-xl' @tap="showModal" data-target="viewModal">
  22. 打开抽屉
  23. </view>
  24. </view>
  25. </scroll-view>
  26. <view class="DrawerClose" :class="modalName=='viewModal'?'show':''" @tap="hideModal">
  27. <text class="cuIcon-pullright"></text>
  28. </view>
  29. <scroll-view scroll-y class="DrawerWindow" :class="modalName=='viewModal'?'show':''">
  30. <view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg">
  31. <view class="cu-item arrow" v-for="(item,index) in 20" :key="index">
  32. <view class="content">
  33. <text class="cuIcon-github text-grey"></text>
  34. <text class="text-grey">{{index +1}}</text>
  35. </view>
  36. </view>
  37. </view>
  38. </scroll-view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. modalName:null
  46. };
  47. },
  48. methods: {
  49. showModal(e) {
  50. this.modalName = e.currentTarget.dataset.target
  51. },
  52. hideModal(e) {
  53. this.modalName = null
  54. },
  55. tabSelect(e) {
  56. this.TabCur = e.currentTarget.dataset.id;
  57. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
  58. }
  59. },
  60. }
  61. </script>
  62. <style>
  63. page {
  64. background-image: var(--gradualBlue);
  65. width: 100vw;
  66. overflow: hidden;
  67. }
  68. .DrawerPage {
  69. position: fixed;
  70. width: 100vw;
  71. height: 100vh;
  72. left: 0vw;
  73. background-color: #f1f1f1;
  74. transition: all 0.4s;
  75. }
  76. .DrawerPage.show {
  77. transform: scale(0.9, 0.9);
  78. left: 85vw;
  79. box-shadow: 0 0 60upx rgba(0, 0, 0, 0.2);
  80. transform-origin: 0;
  81. }
  82. .DrawerWindow {
  83. position: absolute;
  84. width: 85vw;
  85. height: 100vh;
  86. left: 0;
  87. top: 0;
  88. transform: scale(0.9, 0.9) translateX(-100%);
  89. opacity: 0;
  90. pointer-events: none;
  91. transition: all 0.4s;
  92. padding: 100upx 0;
  93. }
  94. .DrawerWindow.show {
  95. transform: scale(1, 1) translateX(0%);
  96. opacity: 1;
  97. pointer-events: all;
  98. }
  99. .DrawerClose {
  100. position: absolute;
  101. width: 40vw;
  102. height: 100vh;
  103. right: 0;
  104. top: 0;
  105. color: transparent;
  106. padding-bottom: 30upx;
  107. display: flex;
  108. align-items: flex-end;
  109. justify-content: center;
  110. background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));
  111. letter-spacing: 5px;
  112. font-size: 50upx;
  113. opacity: 0;
  114. pointer-events: none;
  115. transition: all 0.4s;
  116. }
  117. .DrawerClose.show {
  118. opacity: 1;
  119. pointer-events: all;
  120. width: 15vw;
  121. color: #fff;
  122. }
  123. .DrawerPage .cu-bar.tabbar .action button.cuIcon {
  124. width: 64upx;
  125. height: 64upx;
  126. line-height: 64upx;
  127. margin: 0;
  128. display: inline-block;
  129. }
  130. .DrawerPage .cu-bar.tabbar .action .cu-avatar {
  131. margin: 0;
  132. }
  133. .DrawerPage .nav {
  134. flex: 1;
  135. }
  136. .DrawerPage .nav .cu-item.cur {
  137. border-bottom: 0;
  138. position: relative;
  139. }
  140. .DrawerPage .nav .cu-item.cur::after {
  141. content: "";
  142. width: 10upx;
  143. height: 10upx;
  144. background-color: currentColor;
  145. position: absolute;
  146. bottom: 10upx;
  147. border-radius: 10upx;
  148. left: 0;
  149. right: 0;
  150. margin: auto;
  151. }
  152. .DrawerPage .cu-bar.tabbar .action {
  153. flex: initial;
  154. }
  155. </style>