drawerWindow.vue 3.6 KB

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