drawerWindow.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. type : {
  58. type : String,
  59. default : ''
  60. },
  61. },
  62. data() {
  63. return {
  64. };
  65. },
  66. mounted() {
  67. },
  68. methods:{
  69. bottomCall : function() {
  70. this.$emit('bottomFunc');
  71. },
  72. closeDrawer : function(){
  73. this.$emit('closeDrawer');
  74. },
  75. end : function(e) {
  76. if (this.type == 'share') {
  77. return;
  78. }
  79. var type = this.Dever.slideEnd(e);
  80. if (type == 3 || type == 4) {
  81. this.closeDrawer();
  82. }
  83. },
  84. showModal : function(e) {
  85. this.show = true;
  86. },
  87. hideModal : function(e) {
  88. this.closeDrawer();
  89. },
  90. stopFun : function() {
  91. }
  92. }
  93. }
  94. </script>
  95. <style>
  96. .DrawerWindow_left {
  97. position: absolute;
  98. width: 85vw;
  99. height: 100vh;
  100. left: 0;
  101. top: 0;
  102. transform: scale(1, 1) translateX(-100%);
  103. opacity: 1;
  104. pointer-events: none;
  105. transition: all 0.4s;
  106. }
  107. .DrawerWindow_left.show {
  108. transform: scale(1, 1) translateX(0%);
  109. opacity: 1;
  110. pointer-events: all;
  111. }
  112. .DrawerWindow_down {
  113. position: absolute;
  114. width: 85vw;
  115. height: 100vh;
  116. left: 0;
  117. top: 0;
  118. transform: scale(1, 1) translateY(100%);
  119. opacity: 1;
  120. pointer-events: none;
  121. transition: all 0.4s;
  122. }
  123. .DrawerWindow_down.show {
  124. height: 91vh;
  125. transform: scale(1, 1) translateY(10%);
  126. opacity: 1;
  127. pointer-events: all;
  128. }
  129. .DrawerClose_left {
  130. position: absolute;
  131. width: 40vw;
  132. height: 100vh;
  133. right: 0;
  134. top: 0;
  135. color: transparent;
  136. padding-bottom: 30upx;
  137. display: flex;
  138. align-items: flex-end;
  139. justify-content: center;
  140. /*background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));*/
  141. letter-spacing: 5px;
  142. font-size: 50upx;
  143. opacity: 0;
  144. pointer-events: none;
  145. transition: all 0.4s;
  146. }
  147. .DrawerClose_left.show {
  148. opacity: 1;
  149. pointer-events: all;
  150. width: 15vw;
  151. color: #fff;
  152. }
  153. .DrawerClose_down {
  154. position: absolute;
  155. width: 176vw;
  156. height: 30vh;
  157. left: 0;
  158. top: 0;
  159. color: transparent;
  160. padding-bottom: 30upx;
  161. padding-left: 60upx;
  162. display: flex;
  163. align-items: flex-end;
  164. justify-content: center;
  165. /*background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));*/
  166. letter-spacing: 5px;
  167. font-size: 50upx;
  168. opacity: 0;
  169. pointer-events: none;
  170. transition: all 0.4s;
  171. }
  172. .DrawerClose_down.show {
  173. opacity: 1;
  174. pointer-events: all;
  175. height: 10vh;
  176. color: #fff;
  177. }
  178. .card-menu {
  179. border-radius: 0px;
  180. }
  181. </style>