dmAlterPopView.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view class="pop-view" v-if='visible'>
  3. <view class="pop-maskView" :style="{
  4. 'background-color': maskBgColor,
  5. zIndex: zIndex - 1
  6. }" @tap.stop="handleMaskTap"
  7. @touchmove.stop.prevent="moveHandle">
  8. </view>
  9. <view class='alterView' :style="{zIndex: zIndex}"
  10. @touchmove.stop.prevent="moveHandle">
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. title: String,
  18. maskColor: {
  19. type: String,
  20. default: 'rgba(0, 0, 0, 0.3)'
  21. },
  22. zIndex: {
  23. type: Number,
  24. default: 999
  25. },
  26. maskTapHide: {
  27. type: Boolean,
  28. default: true
  29. },
  30. isShowTitle: {
  31. type: Boolean,
  32. default: true
  33. },
  34. isShowClose: {
  35. type: Boolean,
  36. default: true
  37. },
  38. isShowConfirm: {
  39. type: Boolean,
  40. default: true
  41. }
  42. },
  43. data() {
  44. return {
  45. visible: false,
  46. containerVisible: false,
  47. maskBgColor: '',
  48. selectValue: [0],
  49. selIdx: 0,
  50. themeColor:''
  51. }
  52. },
  53. mounted() {
  54. let app = getApp();
  55. this.globalData = app.globalData;
  56. this.themeColor = this.globalData.themeColor;
  57. },
  58. methods: {
  59. show() {
  60. this.visible = true
  61. setTimeout(() => {
  62. this.maskBgColor = this.maskColor
  63. this.containerVisible = true
  64. }, 20)
  65. },
  66. hide() {
  67. this.maskBgColor = ''
  68. this.containerVisible = false
  69. setTimeout(() => {
  70. this.visible = false
  71. }, 200)
  72. this.$emit('close')
  73. },
  74. handleCancel() {
  75. this.hide()
  76. },
  77. handleConfirm() {
  78. this.hide()
  79. this.$emit('confirm')
  80. },
  81. handleMaskTap() {
  82. if (this.maskTapHide) {
  83. this.hide()
  84. }
  85. },
  86. moveHandle() {},
  87. }
  88. }
  89. </script>
  90. <style scoped lang="scss">
  91. .pop-view {
  92. position: relative;
  93. .pop-maskView {
  94. position: fixed;
  95. top: 0;
  96. right: 0;
  97. left: 0;
  98. bottom: 0;
  99. transition-property: background-color;
  100. transition-duration: 0.3s;
  101. }
  102. .pop-contentView {
  103. position: fixed;
  104. right: 0;
  105. left: 0;
  106. bottom: 0;
  107. background-color: #fff;
  108. border-radius: 40rpx 40rpx 0rpx 0rpx;
  109. box-shadow: 0rpx 8rpx 12rpx 0rpx;
  110. display: flex;
  111. flex-direction: column;
  112. align-items: center;
  113. transform: translateY(100%);
  114. transition-property: transform;
  115. transition-duration: 0.3s;
  116. .pop-title {
  117. margin-top: 60rpx;
  118. font-size: 32rpx;
  119. font-family: Verdana, Verdana-Bold;
  120. font-weight: 700;
  121. text-align: center;
  122. color: #333333;
  123. }
  124. .pop-close {
  125. position: absolute;
  126. top: 64rpx;
  127. right: 30rpx;
  128. width: 40rpx;
  129. height: 40rpx;
  130. }
  131. .pop-commit {
  132. margin-bottom: 54rpx;
  133. width: 260rpx;
  134. height: 84rpx;
  135. line-height: 84rpx;
  136. border-radius: 42rpx;
  137. font-size: 32rpx;
  138. font-family: Verdana, Verdana-Regular;
  139. font-weight: 400;
  140. text-align: center;
  141. color: #ffffff;
  142. }
  143. }
  144. .pop-contentView-show {
  145. transform: translateY(0);
  146. }
  147. }
  148. </style>