dropdown-list.vue 1.2 KB

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