dropdown-list.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="tui-selected-class tui-dropdown-list" :style="{width: width+'rpx', 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. // 下拉框宽度
  29. width: {
  30. type: Number,
  31. default: 200
  32. },
  33. // 下拉框高度 rpx
  34. height: {
  35. type: Number,
  36. default: 0
  37. },
  38. // 选择框高度 单位rpx
  39. selectHeight: {
  40. type: Number,
  41. default: 0
  42. }
  43. },
  44. methods: {
  45. }
  46. }
  47. </script>
  48. <style lang="scss" scoped>
  49. .tui-dropdown-list {
  50. position: relative;
  51. }
  52. .tui-dropdown-view {
  53. width: 100%;
  54. overflow: hidden;
  55. position: absolute;
  56. z-index: 99999;
  57. left: 0;
  58. /* opacity: 0; */
  59. visibility: hidden;
  60. transition: all 0.2s ease-in-out;
  61. box-shadow: 0 6upx 10upx #cccccc
  62. }
  63. .tui-dropdownlist-show {
  64. /* opacity: 1; */
  65. visibility: visible;
  66. }
  67. </style>