index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <u-popup :show="show" @close="close" :safeAreaInsetBottom="safeAreaInsetBottom&&mode=='bottom'" @open="open" :mode="mode">
  3. <view class="pop-content">
  4. <slot name="title">
  5. <view class="popup-title" v-if="title">
  6. {{title}}
  7. </view>
  8. </slot>
  9. <slot />
  10. <slot name="botton">
  11. <view class="popup-btn" v-if="showBtn">
  12. <xbutton width="200rpx" size="large" bgColor="#fff" color="#2C6FF3" borderColor="#2C6FF3" @click="close">取消</xbutton>
  13. <xbutton delay="1500" width="200rpx" size="large" @click="submit">确定</xbutton>
  14. </view>
  15. </slot>
  16. </view>
  17. </u-popup>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. }
  24. },
  25. props: {
  26. mode: {
  27. type: String,
  28. require: false,
  29. default: 'bottom'
  30. },
  31. show: {
  32. type: Boolean,
  33. require: true,
  34. default: false
  35. },
  36. showBtn: {
  37. type: Boolean,
  38. require: true,
  39. default: true
  40. },
  41. title: {
  42. type: String,
  43. require: true,
  44. default: ''
  45. },
  46. safeAreaInsetBottom:{
  47. type: Boolean,
  48. require: false,
  49. default: true
  50. }
  51. },
  52. model: {
  53. prop: 'value',
  54. event: 'change'
  55. },
  56. watch: {
  57. value: {
  58. handler(newVal, oldVal) {
  59. this.fileList = newVal
  60. },
  61. immediate: true,
  62. deep: true
  63. }
  64. },
  65. methods: {
  66. close() {
  67. this.$emit('close', false)
  68. },
  69. open() {
  70. this.$emit('open', true)
  71. },
  72. submit(){
  73. this.$emit('confirm')
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .pop-content{
  80. box-shadow: 0 2rpx 10rpx 0 rgba(0,0,0,0.1);
  81. }
  82. .popup-title {
  83. font-size: 32rpx;
  84. font-weight: bold;
  85. padding: 24rpx;
  86. }
  87. .popup-btn {
  88. display: flex;
  89. flex-flow: row nowrap;
  90. justify-content: space-around;
  91. width: 100%;
  92. padding:50rpx 24rpx 24rpx;
  93. .cu-btn {
  94. background-color: #2C6FF3;
  95. color: #fff;
  96. width: 200rpx;
  97. }
  98. .cu-btn1 {
  99. background-color: green;
  100. }
  101. }
  102. </style>