FixedButton.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div class="bottomFixed">
  3. <div class="btn-list" v-if="btnList">
  4. <slot></slot>
  5. </div>
  6. <div class="btn" v-else>
  7. <slot></slot>
  8. </div>
  9. <div class="fixe-info"></div>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'FixedButton',
  15. props: {
  16. btnList: {
  17. type: Boolean,
  18. default: false
  19. }
  20. }
  21. };
  22. </script>
  23. <style lang="less">
  24. .bottomFixed {
  25. .fixe-info {
  26. height: 150px;
  27. }
  28. .btn-list {
  29. position: fixed;
  30. background-color: #fff;
  31. left: 0;
  32. right: 0;
  33. bottom: 0;
  34. // padding: 8px 10px;
  35. z-index: 200;
  36. box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.04);
  37. display: flex;
  38. align-items: center;
  39. ._van-button {
  40. width: 50%;
  41. box-sizing: border-box;
  42. padding: 0 6px;
  43. }
  44. .van-button {
  45. height: 40px;
  46. }
  47. padding-top: 8px;
  48. padding-left: 10px;
  49. padding-right: 10px;
  50. padding-bottom: calc(8px + constant(safe-area-inset-bottom));
  51. padding-bottom: calc(8px + env(safe-area-inset-bottom));
  52. }
  53. .btn {
  54. position: fixed;
  55. background-color: #fff;
  56. left: 0;
  57. right: 0;
  58. bottom: 0;
  59. // padding: 8px 68px;
  60. padding-top: 8px;
  61. padding-left: 68px;
  62. padding-right: 68px;
  63. padding-bottom: calc(8px + constant(safe-area-inset-bottom));
  64. padding-bottom: calc(8px + env(safe-area-inset-bottom));
  65. z-index: 99;
  66. box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.04);
  67. .van-button {
  68. height: 44px;
  69. }
  70. }
  71. }
  72. </style>