index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <time-select class="cip-form-picker"
  3. :model-value="modelValue"
  4. @update:modelValue="emitInput"
  5. :disabled="disabled"
  6. :placeholder="placeholder"
  7. :style="{width}"
  8. :start="start"
  9. :end="end"
  10. :step="step"
  11. v-bind="attrs"></time-select>
  12. </template>
  13. <script>
  14. import TimeSelect from '@cip/components/cip-time-select'
  15. import { useFormInput } from '@cip/components/hooks/form-input'
  16. import { formInputProps } from '../../form-input-props'
  17. import { computed } from 'vue'
  18. export default {
  19. components: { TimeSelect },
  20. props: formInputProps,
  21. emits: ['update:modelValue'],
  22. setup (props, context) {
  23. const formInput = useFormInput(props, context)
  24. const attrs = computed(() => {
  25. return props.config?.attrs ?? {}
  26. })
  27. const placeholder = computed(() => {
  28. return props.config?.placeholder ?? ''
  29. })
  30. const width = computed(() => {
  31. return props.config?.width ?? ''
  32. })
  33. const start = computed(() => {
  34. return props.config?.start ?? '08:00'
  35. })
  36. const end = computed(() => {
  37. return props.config?.end ?? '20:00'
  38. })
  39. const step = computed(() => {
  40. return props.config?.step ?? '00:30'
  41. })
  42. return {
  43. ...formInput,
  44. attrs,
  45. start,
  46. end,
  47. step,
  48. placeholder,
  49. width
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="less" scoped>
  55. .cip-form-picker{
  56. width: 100%;
  57. }
  58. </style>