12345678910111213141516171819 |
- import { computed } from 'vue'
- import { isEmpty } from '@cip/utils/util'
- export const useRange = (props, defaultJoint = '与') => {
- const min = computed(() => {
- if (isEmpty(props.modelValue)) return props.config?.min
- return props.modelValue > props.config?.min ? props.modelValue : props.config?.min
- })
- const max = computed(() => {
- if (isEmpty(props.otherValue)) return props.config?.max
- return props.otherValue > props.config?.max ? props.config?.max : props.otherValue
- })
- const joint = computed(() => {
- return props.config?.joint ?? defaultJoint
- })
- return {
- min, max, joint
- }
- }
|