postSelect.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view class="desc">
  3. <uni-row>
  4. <uni-col :span="5">
  5. <view class="desc" style="font-size: 25rpx;">
  6. {{label}}
  7. </view>
  8. </uni-col>
  9. <uni-col :span="19">
  10. <view class="pickerView">
  11. <picker @change="postBindPickerChange" :value="post.index" :range="post.data" range-key="postName">
  12. <view class="pickerText" v-if="post.data && post.data.length>0 && post.index !== undefined">
  13. {{ post.data[post.index].postName }}
  14. </view>
  15. <view class="pickerText" v-else>
  16. 待 选 择
  17. </view>
  18. </picker>
  19. </view>
  20. </uni-col>
  21. </uni-row>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. name: 'hs-post-select',
  27. props: {
  28. value: {
  29. Type: String,
  30. default: null
  31. },
  32. label: {
  33. Type: String,
  34. default: '岗位'
  35. }
  36. },
  37. data() {
  38. return {
  39. post: {
  40. data: uni.getStorageSync('postsData'),
  41. index: undefined
  42. }
  43. }
  44. },
  45. onLoad() {
  46. },
  47. methods: {
  48. postBindPickerChange: function(e) {
  49. this.post.index = e.detail.value
  50. this.$emit('input', this.post.data[this.post.index].postId)
  51. },
  52. }
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .desc {
  57. padding: 10rpx 5rpx 0 15rpx;
  58. color: #818181;
  59. font-size: 20rpx;
  60. }
  61. .pickerView {
  62. // align-items: flex-end;
  63. padding: 10rpx 20rpx;
  64. border: 1rpx #eeeeee solid;
  65. }
  66. .pickerText {
  67. font-size: 26rpx;
  68. color: #b1b1b1;
  69. }
  70. </style>