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:checkbox] change 事件返回的 oldChecked 有误 #790

Closed
1 task done
imguolao opened this issue Mar 8, 2022 · 2 comments · Fixed by #792
Closed
1 task done

[comp:checkbox] change 事件返回的 oldChecked 有误 #790

imguolao opened this issue Mar 8, 2022 · 2 comments · Fixed by #792
Assignees
Labels
bug Something isn't working Comp:Checkbox good first issue Good for newcomers

Comments

@imguolao
Copy link
Contributor

imguolao commented Mar 8, 2022

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

Reproduction link

callEmit(props.onChange, checkValue, !checkValue)

Steps to reproduce

<template>
  <IxCheckbox :checked.sync="checked" :true-value="1" :false-value="0" @change="handleChange"  label="选项" />
</template>

<script setup lang="ts">
import { ref } from '@idux/vue2-cdk/vue'

const checked = ref(true)
const handleChange = (checked: boolean | string | number, oldChecked: boolean | string | number) => {
  // 期望结果 1, 0
  // 实际结果 1, false
  console.log(checked, oldChecked)
}
</script>

What is expected?

oldChecked 正常

What is actually happening?

oldChecked 被强制转为 true 和 false

Environment Info

@idux-bot
Copy link

idux-bot bot commented Mar 8, 2022

Translation of this issue:

[COMP: Checkbox] Change event returned to Oldchecked incorrect

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

reproduction link

Components / Checkbox / SRC / CheckBox.tsx # l132)

steps to reproduce

<template>
  <IxCheckbox :checked.sync="checked" :true-value="1" :false-value="0" @change="handleChange"  label="选项" />
</template>

<script setup lang="ts">
import { ref } from '@idux/vue2-cdk/vue'

const checked = ref(true)
const handleChange = (checked: boolean | string | number, oldChecked: boolean | string | number) => {
  // 期望结果 1, 0
  // 实际结果 1, false
  console.log(checked, oldChecked)
}
</script>

What is expected?

Oldchecked is normal

What is actually happens?

Oldchecked is enforced to True and False

Environment Info

@danranVm danranVm added bug Something isn't working good first issue Good for newcomers labels Mar 8, 2022
@danranVm
Copy link
Member

danranVm commented Mar 8, 2022

同时检查下 Radio ,应该也有这个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Comp:Checkbox good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants