drawerWindow.vue 3.5 KB

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