ModalPopup.vue 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <script>
  2. export default {
  3. name: "ModalPopup",
  4. props: {
  5. title: {
  6. type: String,
  7. default: "标题"
  8. },
  9. showBack: {
  10. type: Boolean,
  11. default: false,
  12. }
  13. },
  14. }
  15. </script>
  16. <template>
  17. <van-popup v-bind="$attrs" v-on="$listeners" position="bottom" round get-container="body">
  18. <div class="c-header">
  19. <img src="@/assets/arrow.png" class="back-icon" v-if="showBack" @click="$emit('back')" />
  20. <div class="title-row">
  21. {{ title }}
  22. </div>
  23. </div>
  24. <slot></slot>
  25. </van-popup>
  26. </template>
  27. <style scoped>
  28. /deep/.van-popup--round {
  29. border-radius: 8px !important;
  30. }
  31. .c-header {
  32. display: flex;
  33. align-items: center;
  34. box-sizing: border-box;
  35. padding: 16px 20px;
  36. position: relative;
  37. }
  38. .back-icon {
  39. width: 12px;
  40. height: 12px;
  41. position: absolute;
  42. }
  43. .title-row {
  44. flex: 1;
  45. display: flex;
  46. align-items: center;
  47. justify-content: center;
  48. font-weight: 600;
  49. font-size: 14px;
  50. color: #333333;
  51. }
  52. </style>