Skip to content

Commit

Permalink
feat: Error reported when the maximum value is less than the minimum …
Browse files Browse the repository at this point in the history
…value (#973)

* feat: Error reported when the maximum value is less than or equal to the minimum value

* feat: Error reported when the maximum value is less than the minimum value

* style: delete console.log

* style: add space and remove semicolon

* fix: when min < max will throw Error
  • Loading branch information
GaoNeng-wWw authored Dec 14, 2023
1 parent 74e976e commit 60729f8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/renderless/src/numeric/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,15 @@ const initWatch = ({
state,
watch,
props,
api
api,
}: Pick<INumericRenderlessParams, 'state' | 'watch' | 'props' | 'api'>): void => {

watch(() => [props.max, props.min], ([curMax,curMin]) => {
if (curMax < curMin){
throw new Error('[Numeric]: The maximum value should not be less than to the minimum value')
}
}, { immediate: true })

watch(() => props.modelValue, api.watchValue, { immediate: true })

watch(() => state.isDisplayOnly, api.dispatchDisplayedValue)
Expand Down

0 comments on commit 60729f8

Please sign in to comment.