date-time-pick.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="date-pick-select">
  3. <date-time-picker
  4. :fields="fields"
  5. :start="startTime"
  6. :end="endTime"
  7. :defaultValue="defaultValue"
  8. :disabled="disabled"
  9. @change="bindChange">
  10. <image class="date-icon" src="/static/date-icon.png"></image>
  11. </date-time-picker>
  12. </view>
  13. </template>
  14. <script>
  15. /**
  16. * 日期时间选择器(单个)
  17. */
  18. import DateTimePicker from '@/components/date-time-picker/date-time-picker.vue';
  19. export default {
  20. components: {DateTimePicker},
  21. props: {
  22. label: {
  23. type: String,
  24. default: ''
  25. },
  26. // 时间选择器的粒度 有效值:year | month | day | hour | minute
  27. fields: {
  28. type: String,
  29. default: 'minute'
  30. },
  31. // 允许选中的最小值
  32. startTime: {
  33. type: String,
  34. default: ''
  35. },
  36. // 允许选中的最大值
  37. endTime: {
  38. type: String,
  39. default: ''
  40. },
  41. // 选中的时间
  42. defaultValue: {
  43. type: String,
  44. default: ''
  45. },
  46. //是否禁用
  47. disabled:{
  48. type: Boolean,
  49. default: false
  50. },
  51. // 占位符
  52. placeholder: {
  53. type: String,
  54. default: '日期时间'
  55. },
  56. },
  57. methods: {
  58. bindChange(dateObj){
  59. this.$emit('change', dateObj)
  60. }
  61. }
  62. };
  63. </script>
  64. <style lang="less">
  65. .date-pick-select {
  66. display: flex;
  67. align-items: center;
  68. justify-content: space-between;
  69. min-width: 203.12rpx;
  70. height: 25rpx;
  71. border: 0.78rpx solid #E1E4ED;
  72. border-radius: 3.12rpx;
  73. .uni-input {
  74. min-width: 101.56rpx;
  75. font-size: 12.5rpx;
  76. color: #2E2F33;
  77. }
  78. .date-icon {
  79. margin-left: 7.81rpx;
  80. width: 10.93rpx;
  81. height: 10.93rpx;
  82. }
  83. }
  84. </style>