index.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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" v-if="modelValue">{{modelValue}}</text>
  6. <text v-else class="placeholder-style">{{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" color="#c0c4cc"></u-icon>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. modelValue: {
  18. default: ''
  19. },
  20. textAlign: {
  21. type: String,
  22. default: 'end'
  23. },
  24. placeholder: {
  25. type: String,
  26. default: '请选择'
  27. },
  28. selectOpen: {
  29. type: Boolean,
  30. default: false
  31. },
  32. },
  33. data() {
  34. return {
  35. }
  36. },
  37. methods: {
  38. openSelect() {
  39. this.$emit('openSelect')
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss">
  45. .select-box {
  46. height: 78rpx;
  47. width: 100%;
  48. justify-content: space-between;
  49. .content-box {
  50. width: 100%;
  51. justify-content: flex-end;
  52. .content {
  53. width: 500rpx;
  54. overflow-y: scroll;
  55. .placeholder-style {
  56. color: rgb(192, 196, 204);
  57. }
  58. }
  59. }
  60. }
  61. </style>