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

u-switch组件v-model绑定非布尔值时报错 #1196

Closed
ruandk opened this issue Dec 21, 2021 · 2 comments · May be fixed by #1197
Closed

u-switch组件v-model绑定非布尔值时报错 #1196

ruandk opened this issue Dec 21, 2021 · 2 comments · May be fixed by #1197

Comments

@ruandk
Copy link

ruandk commented Dec 21, 2021

版本

1.8.2

重现步骤

<u-switch v-model="isDefault" :active-value='1' :inactive-value='0'></u-switch>

data(){
  return {
    isDefault: 0
  }
}

期望的结果是什么?

v-model可绑定一个非布尔值,既然active-value和inactive-value支持Boolean | Number | String,value理应也如此

实际的结果是什么?

v-model绑定非布尔值时报错


服务端给到数据为非布尔值,u-switch也支持指定active-value和inactive-value,并且支持多种类型,value不应只支持布尔值,应避免带来不必要的类型转换

@yatoku
Copy link
Collaborator

yatoku commented Jan 21, 2022

v-model需要绑定的就是布尔值,设置了acttive-valueinactive-value,只是可以在触发change事件时可以接收。

@yatoku yatoku closed this as completed Jan 21, 2022
@ruandk
Copy link
Author

ruandk commented Apr 20, 2022

@yatoku uView2.0已支持,为啥uView1.8不可以同步支持?老项目换成uView2.0改动大

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

Successfully merging a pull request may close this issue.

2 participants