index.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view class="u-line-1 u-flex select-box" @click="openSelect">
  3. <view class="u-flex content-box">
  4. <view class="content" :style="{textAlign:textAlign}">
  5. <text class="u-line-1" :class="{'disabled':disabled}" v-if="modelValue">{{modelValue}}</text>
  6. <text v-else class="placeholder-style" :class="{'disabled':disabled}">{{placeholder}}</text>
  7. </view>
  8. </view>
  9. <view class="u-input__right-icon--select u-input__right-icon__item">
  10. <u-icon :name="selectOpen ? 'arrow-up' : 'arrow-right'" size="26"
  11. :color="disabled?'#9B9B9B':'#c0c4cc'"></u-icon>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. props: {
  18. modelValue: {
  19. default: ''
  20. },
  21. textAlign: {
  22. type: String,
  23. default: 'end'
  24. },
  25. placeholder: {
  26. type: String,
  27. default: '请选择'
  28. },
  29. selectOpen: {
  30. type: Boolean,
  31. default: false
  32. },
  33. disabled: {
  34. type: Boolean,
  35. default: false
  36. }
  37. },
  38. methods: {
  39. openSelect() {
  40. this.$emit('openSelect')
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. .select-box {
  47. height: 78rpx;
  48. width: 100%;
  49. justify-content: space-between;
  50. .content-box {
  51. width: 100%;
  52. justify-content: flex-end;
  53. .content {
  54. width: 100%;
  55. overflow-y: scroll;
  56. .disabled {
  57. color: #9B9B9B !important;
  58. }
  59. .placeholder-style {
  60. color: rgb(192, 196, 204);
  61. }
  62. }
  63. }
  64. }
  65. </style>