index.vue 1.5 KB

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