bottom-drawer.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="cu-modal bottom-modal" :class="show ? 'show' : ''" @click="close">
  3. <view class="cu-dialog" @click.stop="() => {}">
  4. <view class="cu-bar bg-white justify-end">
  5. <view class="content">{{ title }}</view>
  6. <view class="action" @click="close">
  7. <text class="cuIcon-close"></text>
  8. </view>
  9. </view>
  10. <view class="padding-sm content">
  11. <view class="padding-lr-xs">
  12. <slot></slot>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. props: {
  21. value: {
  22. type: Boolean,
  23. default: false
  24. },
  25. title: {
  26. type: String,
  27. default: '菜单'
  28. }
  29. },
  30. data() {
  31. return {
  32. show: this.value
  33. };
  34. },
  35. watch: {
  36. value (n, o) {
  37. this.show = this.value
  38. }
  39. },
  40. methods: {
  41. open() {
  42. this.show = true;
  43. this.$emit('input', this.show)
  44. },
  45. close() {
  46. this.show = false;
  47. this.$emit('input', this.show)
  48. }
  49. }
  50. };
  51. </script>
  52. <style>
  53. .cu-dialog {
  54. border-radius: 20upx 20upx 0 0;
  55. padding-bottom: 40upx;
  56. background: #fff;
  57. }
  58. .content {
  59. background-color: #fff;
  60. padding-top: 16upx;
  61. }
  62. .cu-bar .content {
  63. color: #333333;
  64. font-weight: 700;
  65. }
  66. </style>