drawerWindow.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template name="drawerWindow">
  2. <view :style="{background:background,zIndex:zIndex, top:top+'px'}">
  3. <view :class="['DrawerClose_' + direction, show ? 'show' : '']" @tap="hideModal">
  4. <text :class="'cuIcon-pull'+direction"></text>
  5. </view>
  6. <scroll-view scroll-y :class="['DrawerWindow_' + direction, show ? 'show' : '']" :style="{width:width,padding:padding, zIndex:zIndex+1, background:slotBg}" @tap.stop="stopFun" @touchstart="Dever.slide" @touchend="end" @scrolltolower="bottomCall">
  7. <view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg" v-if="show">
  8. <slot name="links"></slot>
  9. </view>
  10. </scroll-view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. name: "drawerWindow",
  16. props: {
  17. show : {
  18. type : Boolean,
  19. default : false
  20. },
  21. direction : {
  22. type : String,
  23. default : 'left'
  24. },
  25. width : {
  26. type : String,
  27. default : '60%'
  28. },
  29. background:{
  30. type : String,
  31. default : 'rgba(0, 0, 0, 0.5)'
  32. },
  33. slotBg:{
  34. type : String,
  35. default : 'rgba(255, 255, 255, 1)'
  36. },
  37. padding :{
  38. type : String,
  39. default : '30rpx'
  40. },
  41. zIndex : {
  42. type : Number,
  43. default : 10
  44. },
  45. // #ifdef H5
  46. top:{
  47. type : Number,
  48. default : 44
  49. },
  50. // #endif
  51. // #ifndef H5
  52. top:{
  53. type : Number,
  54. default : 0
  55. },
  56. // #endif
  57. },
  58. data() {
  59. return {
  60. };
  61. },
  62. mounted() {
  63. },
  64. methods:{
  65. bottomCall : function() {
  66. this.$emit('bottomFunc');
  67. },
  68. closeDrawer : function(){
  69. this.$emit('closeDrawer');
  70. },
  71. end : function(e) {
  72. var type = this.Dever.slideEnd(e);
  73. if (type == 3 || type == 4) {
  74. this.closeDrawer();
  75. }
  76. },
  77. showModal : function(e) {
  78. this.show = true;
  79. },
  80. hideModal : function(e) {
  81. this.closeDrawer();
  82. },
  83. stopFun : function() {
  84. }
  85. }
  86. }
  87. </script>
  88. <style>
  89. .DrawerWindow_left {
  90. position: absolute;
  91. width: 85vw;
  92. height: 100vh;
  93. left: 0;
  94. top: 0;
  95. transform: scale(1, 1) translateX(-100%);
  96. opacity: 1;
  97. pointer-events: none;
  98. transition: all 0.4s;
  99. }
  100. .DrawerWindow_left.show {
  101. transform: scale(1, 1) translateX(0%);
  102. opacity: 1;
  103. pointer-events: all;
  104. }
  105. .DrawerWindow_down {
  106. position: absolute;
  107. width: 85vw;
  108. height: 100vh;
  109. left: 0;
  110. top: 0;
  111. transform: scale(1, 1) translateY(100%);
  112. opacity: 1;
  113. pointer-events: none;
  114. transition: all 0.4s;
  115. }
  116. .DrawerWindow_down.show {
  117. height: 84vh;
  118. transform: scale(1, 1) translateY(20%);
  119. opacity: 1;
  120. pointer-events: all;
  121. }
  122. .DrawerClose_left {
  123. position: absolute;
  124. width: 40vw;
  125. height: 100vh;
  126. right: 0;
  127. top: 0;
  128. color: transparent;
  129. padding-bottom: 30upx;
  130. display: flex;
  131. align-items: flex-end;
  132. justify-content: center;
  133. /*background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));*/
  134. letter-spacing: 5px;
  135. font-size: 50upx;
  136. opacity: 0;
  137. pointer-events: none;
  138. transition: all 0.4s;
  139. }
  140. .DrawerClose_left.show {
  141. opacity: 1;
  142. pointer-events: all;
  143. width: 15vw;
  144. color: #fff;
  145. }
  146. .DrawerClose_down {
  147. position: absolute;
  148. width: 100vh;
  149. height: 30vh;
  150. left: 0;
  151. top: 0;
  152. color: transparent;
  153. padding-bottom: 30upx;
  154. padding-left: 60upx;
  155. display: flex;
  156. align-items: flex-end;
  157. justify-content: center;
  158. /*background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));*/
  159. letter-spacing: 5px;
  160. font-size: 50upx;
  161. opacity: 0;
  162. pointer-events: none;
  163. transition: all 0.4s;
  164. }
  165. .DrawerClose_down.show {
  166. opacity: 1;
  167. pointer-events: all;
  168. height: 18vh;
  169. color: #fff;
  170. }
  171. .card-menu {
  172. border-radius: 0px;
  173. }
  174. </style>