style-bottom-view.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="fixed-bottom-view-placeholder"></view>
  3. <view
  4. class="fixed-bottom-view"
  5. :class="{
  6. 'fixed-bottom-view-shadow ': shadow,
  7. 'fixed-bottom-view-hidden': hidden,
  8. }"
  9. :style="{
  10. zIndex,
  11. background,
  12. }"
  13. >
  14. <slot></slot>
  15. </view>
  16. </template>
  17. <script lang="ts">
  18. export default {
  19. props: {
  20. shadow: Boolean,
  21. hidden: Boolean,
  22. background: {
  23. type: String,
  24. default: "#ffffff",
  25. },
  26. zIndex: {
  27. type: Number,
  28. default: 999,
  29. },
  30. },
  31. };
  32. </script>
  33. <style lang="scss">
  34. .fixed-bottom-view {
  35. position: fixed;
  36. width: 100%;
  37. left: 0;
  38. bottom: 0;
  39. transition: all 0.3s linear;
  40. box-sizing: content-box;
  41. padding-bottom: constant(safe-area-inset-bottom);
  42. padding-bottom: env(safe-area-inset-bottom);
  43. }
  44. .fixed-bottom-view-placeholder {
  45. box-sizing: content-box;
  46. padding-bottom: constant(safe-area-inset-bottom);
  47. padding-bottom: env(safe-area-inset-bottom);
  48. }
  49. .fixed-bottom-view-shadow {
  50. box-shadow: 0px 0px 40rpx 0px rgba(157, 147, 142, 0.36);
  51. }
  52. .fixed-bottom-view-hidden {
  53. transform: translateY(100%);
  54. }
  55. </style>