tui-dropdown-list.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="tui-selected-class tui-dropdown-list" :style="{ height: selectHeight ? selectHeight + 'rpx' : 'auto' }">
  3. <slot name="selectionbox"></slot>
  4. <view
  5. class="tui-dropdown-view"
  6. :class="[show ? 'tui-dropdownlist-show' : '']"
  7. :style="{ backgroundColor: backgroundColor, height: show ? height + 'rpx' : 0, top: top + 'rpx' }"
  8. >
  9. <slot name="dropdownbox"></slot>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. name: 'tuiDropdownList',
  16. props: {
  17. //控制显示
  18. show: {
  19. type: Boolean,
  20. default: false
  21. },
  22. //背景颜色
  23. backgroundColor: {
  24. type: String,
  25. default: 'transparent'
  26. },
  27. //top rpx
  28. top: {
  29. type: Number,
  30. default: 0
  31. },
  32. //下拉框高度 rpx
  33. height: {
  34. type: Number,
  35. default: 0
  36. },
  37. //选择框高度 单位rpx
  38. selectHeight: {
  39. type: Number,
  40. default: 0
  41. }
  42. },
  43. methods: {}
  44. };
  45. </script>
  46. <style scoped>
  47. .tui-dropdown-list {
  48. position: relative;
  49. }
  50. .tui-dropdown-view {
  51. width: 100%;
  52. overflow: hidden;
  53. position: absolute;
  54. z-index: -99;
  55. left: 0;
  56. opacity: 0;
  57. /* visibility: hidden; */
  58. transition: all 0.2s ease-in-out;
  59. }
  60. .tui-dropdownlist-show {
  61. opacity: 1;
  62. z-index: 996;
  63. /* visibility: visible; */
  64. }
  65. </style>