index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="oa-item-popup">
  3. <view class="c-row b-b" @tap.stop="show">
  4. <view class="left">
  5. <text class="tit">{{ title }}</text>
  6. </view>
  7. <view class="mid">
  8. <slot name="content" v-if="!isEmpty"></slot>
  9. <view class="empty" v-else>
  10. {{ empty }}
  11. </view>
  12. </view>
  13. <slot class="right" name="right"></slot>
  14. </view>
  15. <!--规格-模态层弹窗-->
  16. <view class="popup" :class="specClass">
  17. <!-- 遮罩层 -->
  18. <view class="mask" @tap="hide"></view>
  19. <!--内容层-->
  20. <view class="layer">
  21. <slot name="popup"></slot>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. /**
  28. * @des 点击item 显示popup
  29. *
  30. * @author hjp1011 21931118@qq.com
  31. * @date 2020-04-16 11:15
  32. */
  33. export default {
  34. name: 'rfItemPopup',
  35. props: {
  36. title: {
  37. type: String,
  38. default: ''
  39. },
  40. empty: {
  41. type: String,
  42. default: ''
  43. },
  44. specClass: {
  45. type: String,
  46. default: 'none'
  47. },
  48. isEmpty: {
  49. type: Boolean,
  50. default: false
  51. }
  52. },
  53. methods: {
  54. show() {
  55. this.$emit('show');
  56. },
  57. hide() {
  58. this.$emit('hide');
  59. },
  60. stopPrevent() {}
  61. }
  62. };
  63. </script>
  64. <style lang="scss">
  65. .oa-item-popup {
  66. font-size: $font-sm + 2upx;
  67. color: $font-color-base;
  68. background: #fff;
  69. .c-row {
  70. display: flex;
  71. align-items: center;
  72. padding: 20upx 30upx;
  73. position: relative;
  74. .left {
  75. width: 140upx;
  76. }
  77. .mid {
  78. flex: 1;
  79. }
  80. .right {
  81. }
  82. .empty {
  83. font-size: $font-base;
  84. }
  85. }
  86. .popup {
  87. position: fixed;
  88. left: 0;
  89. top: 0;
  90. right: 0;
  91. bottom: 0;
  92. z-index: 99;
  93. &.show {
  94. display: block;
  95. .mask {
  96. animation: showPopup 0.2s linear both;
  97. }
  98. .layer {
  99. animation: showLayer 0.2s linear both;
  100. }
  101. }
  102. &.hide {
  103. .mask {
  104. animation: hidePopup 0.2s linear both;
  105. }
  106. .layer {
  107. animation: hideLayer 0.2s linear both;
  108. }
  109. }
  110. &.none {
  111. display: none;
  112. }
  113. .mask {
  114. position: fixed;
  115. top: 0;
  116. width: 100%;
  117. height: 100%;
  118. z-index: 1;
  119. background-color: rgba(0, 0, 0, 0.4);
  120. }
  121. .layer {
  122. position: fixed;
  123. z-index: 99;
  124. bottom: 0;
  125. width: 100%;
  126. border-radius: 10upx 10upx 0 0;
  127. background-color: #fff;
  128. }
  129. &.service {
  130. min-height: 600upx;
  131. .row {
  132. margin: 30upx;
  133. .title {
  134. font-size: 30upx;
  135. margin: 10upx 0;
  136. }
  137. .description {
  138. font-size: 28upx;
  139. color: #999;
  140. }
  141. }
  142. }
  143. @keyframes showPopup {
  144. 0% {
  145. opacity: 0;
  146. }
  147. 100% {
  148. opacity: 1;
  149. }
  150. }
  151. @keyframes hidePopup {
  152. 0% {
  153. opacity: 1;
  154. }
  155. 100% {
  156. opacity: 0;
  157. }
  158. }
  159. @keyframes showLayer {
  160. 0% {
  161. transform: translateY(120%);
  162. }
  163. 100% {
  164. transform: translateY(0%);
  165. }
  166. }
  167. @keyframes hideLayer {
  168. 0% {
  169. transform: translateY(0);
  170. }
  171. 100% {
  172. transform: translateY(120%);
  173. }
  174. }
  175. }
  176. }
  177. </style>