Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[comp:slider] onChange 事件的触发时机 #696

Closed
1 task done
imguolao opened this issue Dec 30, 2021 · 2 comments · Fixed by #721
Closed
1 task done

[comp:slider] onChange 事件的触发时机 #696

imguolao opened this issue Dec 30, 2021 · 2 comments · Fixed by #721
Assignees

Comments

@imguolao
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

目前 slider 组件的 onChange 有两个触发时机,一个是 mouseUp 阶段,另一个是在 v-model 传入值时,如果值为非法值的话,slider 为了正常渲染会将其修正为合法值,并触发 onChange,是否保留此触发时机?

// When the legal value is not equal to the modelValue, update modelValue
if (val.every((v, i) => v !== newVal[i])) {
const modelValue = props.range ? newVal : newVal[0]
callEmit(props.onChange, modelValue)
accessor.setValue(modelValue)
}

What does the proposed API look like?

@idux-bot
Copy link

idux-bot bot commented Dec 30, 2021

Translation of this issue:

[COMP: SLIDER] onchange event trigger time

  • i Have Searched The [https://github.com/iduxfe/idux/issues) of this repository and believe That this is not a duplicate.

What proBLEES THIS Feature SOLVE?

Current Slider Component's onchange There are two trigger time, one is the mouseup stage, the other is when the V-MODEL incoming value, if the value is illegal, slider is the normal rendering willCorrect into legitimate values and trigger the onchange, do you keep this trigger?

Https://github.com/iduxfe/idux/blob/de7f2f8b59c383e28df9430856dab802783fc3e2/packages/components/slider/src/USESLIDER.TS#L321-L326

What does The proposed API Look Like?

none

@danranVm
Copy link
Member

danranVm commented Jan 5, 2022

我建议是这个地方不对值进行修改,给个 DEV 下的 log.warn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants