dictSelect.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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="bindPickerChange" :value="index" :range="data" range-key="dictLabel">
  12. <view class="pickerText" v-if="data && data.length>0 && index !== undefined">
  13. {{ data[index].dictLabel }}
  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. //
  26. export default {
  27. name: 'hs-post-select',
  28. props: {
  29. value: {
  30. Type: String,
  31. default: null
  32. },
  33. label: {
  34. Type: String,
  35. default: '岗位'
  36. },
  37. dictKey: {
  38. Type: String,
  39. default: null
  40. },
  41. },
  42. data() {
  43. return {
  44. data: [],
  45. index: undefined
  46. }
  47. },
  48. mounted() {
  49. this.data = uni.getStorageSync(this.dictKey)
  50. },
  51. methods: {
  52. bindPickerChange: function(e) {
  53. this.index = e.detail.value
  54. this.$emit('input', this.data[this.index].dictValue)
  55. },
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .desc {
  61. padding: 10rpx 15rpx 0 15rpx;
  62. color: #818181;
  63. font-size: 20rpx;
  64. }
  65. .pickerView {
  66. // align-items: flex-end;
  67. padding: 10rpx 20rpx;
  68. margin-right: 20rpx;
  69. border: 1rpx #eeeeee solid;
  70. }
  71. .pickerText {
  72. font-size: 26rpx;
  73. color: #b1b1b1;
  74. }
  75. </style>