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

[Bug Report] el-switch's V-model is incorrect when it is introduced into int type. #11698

Closed
KiddoLin opened this issue Jun 21, 2018 · 2 comments

Comments

@KiddoLin
Copy link

Element UI version

2.4.1

OS/Browsers version

win10 / Chrome 66.0.3359.117

Vue version

2.5.16

Reproduction Link

https://jsfiddle.net/esn7rfo3/3/

Steps to reproduce

1.将左下栏目的js代码增加
mounted() {
let val = 100;
this.value5 = val;
}

即,整体修改为
var Main = {
data() {
return {
value5: '100'
}
},
mounted() {
let val = 100;
this.value5 = val;
}
};
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')
2.点击左上角运行,发现右侧switch按钮为关闭

3.将 let val = 100; 改为 let val = ‘100’;
4.点击左上角运行,发现右侧switch按钮为开启

What is Expected?

无论v-model的值为 '100' 或 100 ,只要值等于el-switch的active-value,switch按钮为开启

What is actually happening?

左上栏目的html代码中,无论el-switch标签的active-value属性为 active-value="100" 或 active-value=100 ,当value5为 '100'(string) 时皆为开启,当value5 为 100(int) 时皆为关闭。
故,应是对v-model的值为int时判断有误吧

@element-bot element-bot changed the title [Bug Report] el-switch的v-model传入int类型时判断有误 [Bug Report] el-switch's V-model is incorrect when it is introduced into int type. Jun 21, 2018
@element-bot
Copy link
Member

Translation of this issue:

Element UI version
2.4.1

OS/Browsers version
Win10 / Chrome 66.0.3359.117

Vue version
2.5.16

Reproduction Link
https://jsfiddle.net/esn7rfo3/3/

Steps to reproduce

  1. increase the JS code of the left column

Mounted () {
Let Val = 100;

This.value5 = Val;
}

That is, the overall modification is
Var Main = {{

Data () {
Return {

Value5:'100'
}

},
Mounted () {

Let Val = 100;
This.value5 = Val;

}
};

Var Ctor = Vue.extend (Main)
New Ctor ().$mount ('#app')

  1. click on the upper left corner to find the right switch button to close.

  2. let Val = 100; change to let Val = '100';

  3. click on the upper left corner to find the right switch button to open.
    What is Expected?

Whether the value of V-model is'100'or 100, if the value is equal to el-switch active-value, the switch button is opened.
What is actually happening?

In the HTML code of the upper left column, the active-value attribute of the el-switch tag is active-value= "100" or active-value=100, and when value5 is'100'(string), it is closed when value5 is 100 (int).
Therefore, it should be wrong when the value of V-model is int.

@jikkai
Copy link
Contributor

jikkai commented Jun 21, 2018

Duplicate of #11381

@jikkai jikkai marked this as a duplicate of #11381 Jun 21, 2018
@jikkai jikkai closed this as completed Jun 21, 2018
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

No branches or pull requests

3 participants