en-popup.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view @touchmove.stop.prevent="moveHandle">
  3. <uni-popup ref="popup" @change="setTabBar" type="bottom" :mask-background-color="maskBackgroundColor">
  4. <view class="popup-box" v-show="showTop">
  5. <view class="popup-title" @click="close">
  6. <view class="popup-close">
  7. <image class="popup-close-img" src="/static/img/common/close.png" mode="widthFix" ></image>
  8. </view>
  9. </view>
  10. <slot name="popupInfo"></slot>
  11. </view>
  12. </uni-popup>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: "en-popup",
  18. components: {},
  19. props: {
  20. showTop:{
  21. type:Boolean,
  22. default:true
  23. },
  24. maskBackgroundColor:{
  25. default: 'rgba(0,0,0,0.4)'
  26. }
  27. },
  28. data() {
  29. return {
  30. popupShow:false
  31. }
  32. },
  33. watch: {},
  34. mounted() {
  35. },
  36. methods: {
  37. moveHandle() {
  38. return false
  39. },
  40. open(){
  41. this.$refs.popup.open('bottom')
  42. },
  43. setTabBar(e){
  44. if(e.show){
  45. this.popupShow = true;
  46. uni.hideTabBar()
  47. }else {
  48. this.popupShow = false;
  49. uni.showTabBar()
  50. }
  51. },
  52. close(){
  53. this.$refs.popup.close()
  54. }
  55. }
  56. }
  57. </script>
  58. <style scoped lang="scss">
  59. .popupShow {
  60. overflow: hidden;
  61. position: fixed;
  62. }
  63. .popup-box{
  64. background: #FFFFFF;
  65. border-radius: 30rpx 30rpx 0 0;
  66. box-shadow: 0px -8px 20px 0px rgba(0,0,0,0.04);
  67. padding: 42rpx 32rpx calc(16rxp + env(safe-area-inset-bottom));
  68. z-index: 999999;
  69. .popup-title{
  70. padding: 20rpx 0;
  71. width: 100%;
  72. .popup-close{
  73. width: 72rpx;
  74. margin: auto;
  75. border-radius: 30rpx;
  76. .popup-close-img {
  77. width: 72rpx;
  78. }
  79. }
  80. }
  81. }
  82. </style>