drawerWindow.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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="false" :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. uni-scroll-view {
  99. overflow: hidden;
  100. }
  101. .DrawerWindow_left {
  102. position: absolute;
  103. width: 85vw;
  104. height: 100vh;
  105. left: 0;
  106. top: 0;
  107. transform: scale(1, 1) translateX(-100%);
  108. opacity: 1;
  109. pointer-events: none;
  110. transition: all 0.4s;
  111. }
  112. .DrawerWindow_left.show {
  113. transform: scale(1, 1) translateX(0%);
  114. opacity: 1;
  115. pointer-events: all;
  116. }
  117. .DrawerWindow_down {
  118. position: absolute;
  119. width: 85vw;
  120. height: 100vh;
  121. left: 0;
  122. top: 0;
  123. transform: scale(1, 1) translateY(100%);
  124. opacity: 1;
  125. pointer-events: none;
  126. transition: all 0.4s;
  127. }
  128. .DrawerWindow_down.show {
  129. height: 91vh;
  130. transform: scale(1, 1) translateY(10%);
  131. opacity: 1;
  132. pointer-events: all;
  133. }
  134. .DrawerClose_left {
  135. position: absolute;
  136. width: 40vw;
  137. height: 100vh;
  138. right: 0;
  139. top: 0;
  140. color: transparent;
  141. padding-bottom: 30upx;
  142. display: flex;
  143. align-items: flex-end;
  144. justify-content: center;
  145. /*background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));*/
  146. letter-spacing: 5px;
  147. font-size: 50upx;
  148. opacity: 0;
  149. pointer-events: none;
  150. transition: all 0.4s;
  151. }
  152. .DrawerClose_left.show {
  153. opacity: 1;
  154. pointer-events: all;
  155. width: 15vw;
  156. color: #fff;
  157. }
  158. .DrawerClose_down {
  159. position: absolute;
  160. width: 176vw;
  161. height: 30vh;
  162. left: 0;
  163. top: 0;
  164. color: transparent;
  165. padding-bottom: 30upx;
  166. padding-left: 60upx;
  167. display: flex;
  168. align-items: flex-end;
  169. justify-content: center;
  170. /*background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.6));*/
  171. letter-spacing: 5px;
  172. font-size: 50upx;
  173. opacity: 0;
  174. pointer-events: none;
  175. transition: all 0.4s;
  176. }
  177. .DrawerClose_down.show {
  178. opacity: 1;
  179. pointer-events: all;
  180. height: 10vh;
  181. color: #fff;
  182. }
  183. .card-menu {
  184. border-radius: 0px;
  185. }
  186. </style>