dt_dialog.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <!-- 人数拼座 -->
  3. <view class="dialog-wrap" :style="'z-index:'+zIndex">
  4. <!-- 遮罩 -->
  5. <view class="mask" :class="{ show: visible }" @tap="tapDialogShow"></view>
  6. <view class="content-mn"
  7. :class="{
  8. bottom:direction=='bottom',
  9. top:direction=='top',
  10. right:direction=='right',
  11. left:direction=='left',
  12. center:direction=='center',
  13. show: visible,
  14. isRadius:isRadius
  15. }"
  16. :style="{'background-color':conf.mainBgColor}">
  17. <view v-if="isTitle" class="head-wrap">
  18. <view :class="'title ' + titleClass">{{ title }}</view>
  19. <image
  20. v-if="isCloseBtn"
  21. @tap="tapDialogShow"
  22. class="close"
  23. src="http://139.9.103.171:1888/img/image/close.png"
  24. mode="widthFix"
  25. ></image>
  26. </view>
  27. <view class="main-wrap">
  28. <slot name="main"></slot>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. props: {
  36. direction:{
  37. type:String,
  38. default:'bottom' // top
  39. },
  40. isTitle: {
  41. type: Boolean,
  42. default: true
  43. },
  44. isCloseBtn: {
  45. type: Boolean,
  46. default: true
  47. },
  48. isRadius:{
  49. type: Boolean,
  50. default: true
  51. },
  52. titleClass: {
  53. type: String,
  54. default: ""
  55. },
  56. title: {
  57. type: String,
  58. default: "标题"
  59. },
  60. visible: {
  61. type: Boolean,
  62. default: false
  63. },
  64. zIndex:{
  65. type: [Number,String],
  66. default: 100
  67. },
  68. config:{
  69. type:Object,
  70. default: ()=>{
  71. return {}
  72. }
  73. }
  74. },
  75. watch:{
  76. config:{
  77. deep:true,
  78. handler:(n,o)=>{
  79. console.log(79,n)
  80. if(n){
  81. this.conf = Object.assign({},n)
  82. }
  83. }
  84. }
  85. },
  86. data(){
  87. return {
  88. conf:{}
  89. }
  90. },
  91. methods: {
  92. tapDialogShow() {
  93. this.$emit("update:visible", false);
  94. this.$emit("close")
  95. }
  96. },
  97. created(){
  98. console.log(93,this.conf, this.config)
  99. this.conf = Object.assign({},this.config)
  100. },
  101. };
  102. </script>
  103. <style lang="scss">
  104. // 弹窗 选择人数拼车
  105. .dialog-wrap {
  106. position: relative;
  107. width: 100%;
  108. z-index: 100;
  109. .mask.show {
  110. visibility: visible;
  111. opacity: 1;
  112. }
  113. .mask {
  114. position: fixed;
  115. top: 0;
  116. width: 100vw;
  117. height: 100vh;
  118. background-color: rgba(0, 0, 0, 0.3);
  119. transition: all 0.3s ease;
  120. visibility: hidden;
  121. opacity: 0;
  122. }
  123. .isRadius{
  124. border-radius:14upx 14upx 0upx 0upx;
  125. }
  126. .content-mn {
  127. position: fixed;
  128. left: 0;
  129. width: 100%;
  130. background-color: #fff;
  131. // padding-bottom: 1upx;
  132. transition: all 0.3s ease;
  133. z-index: 102;
  134. .head-wrap {
  135. position: relative;
  136. display: flex;
  137. align-items: center;
  138. padding: 0 30upx;
  139. min-height: 90upx;
  140. font-size: 28upx;
  141. .title {
  142. width: 100%;
  143. font-size:30upx;
  144. }
  145. .title-center {
  146. text-align: center;
  147. }
  148. .close {
  149. position: absolute;
  150. right: 0;
  151. top: 50%;
  152. transform: translateY(-50%);
  153. padding: 30upx;
  154. width: 22upx;
  155. height: 22upx;
  156. }
  157. }
  158. .main-wrap {
  159. width: 100%;
  160. }
  161. }
  162. .center{
  163. top:50%;
  164. left:50%;
  165. transform: translate(-50%,-50%) scale(0.5);
  166. opacity: 0;
  167. visibility:hidden;
  168. }
  169. .top{
  170. top: 0;
  171. transform: translateY(-100%);
  172. }
  173. .right{
  174. top:0;
  175. right:0;
  176. transform: translateX(100%);
  177. }
  178. .bottom{
  179. bottom: 0;
  180. transform: translateY(100%);
  181. }
  182. .left{
  183. top:0;
  184. left:0;
  185. transform: translateX(-100%);
  186. }
  187. .center.show{
  188. transform: translate(-50%,-50%) scale(1);
  189. opacity:1;
  190. visibility:visible;
  191. }
  192. .top.show,
  193. .bottom.show {
  194. transform: translateY(0);
  195. }
  196. .right.show,
  197. .left.show{
  198. transform: translateX(0);
  199. }
  200. }
  201. </style>