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

[select]更新1.0.4后select的option不能绑定object? #1533

Closed
ruiyong-lee opened this issue Dec 3, 2016 · 12 comments
Closed

[select]更新1.0.4后select的option不能绑定object? #1533

ruiyong-lee opened this issue Dec 3, 2016 · 12 comments

Comments

@ruiyong-lee
Copy link

image
image
更新1.0.4后select的option不能绑定object?
我整个页面用到select的都报错了,这是怎么回事?

@Leopoldthecoder
Copy link
Contributor

我试了一下是可以的:http://jsfiddle.net/Lq0qbjgo/ ,请提供能重现问题的 demo

@ruiyong-lee
Copy link
Author

image

@Leopoldthecoder 应该是给他一个初始值时不能是对象的错误,我之前都是这样给初始值都不会报错,1.0.3之前都不会

@Leopoldthecoder
Copy link
Contributor

这种情况下,如果需要给初始值的话,可能需要这样写:http://jsfiddle.net/leopoldthecuber/Lq0qbjgo/1/ 。因为按照截图里的写法,value 和对应 option 的 value 属性其实引用的是两个不同的对象。

试了一下,在 1.0.3 及之前的版本里,按照截图里的写法,输入框里是空的,这也是不对的。

@ruiyong-lee
Copy link
Author

image
image
image
@Leopoldthecoder 发现不设置初始值也会,之前都是这样写的,有啥需要改进的请指教

@Leopoldthecoder
Copy link
Contributor

提供一个能重现的 demo 吧

@ruiyong-lee
Copy link
Author

image
我知道问题了,初始化不能是一个空的对象。。。

@Leopoldthecoder
Copy link
Contributor

是的,还是按我上面那个 demo 的方法来处理,或者初始化为一个空字符串。我再想想我这边有没有更好的处理办法。

@ruiyong-lee
Copy link
Author

image

image
@Leopoldthecoder 之前这样设置初始值都是可以的,不会报错,现在我只能用你们的1.0.3.不升级了,要不整个项目改动好大

@yuanshengchao
Copy link

这个select在1.0.4版本里出现的bug太大了,1.0.3以前还是好的。

@Leopoldthecoder
Copy link
Contributor

@yuanshengchao 请新开一个 issue 并提供 demo。

@Leopoldthecoder
Copy link
Contributor

@lry210 可以先锁定 1.0.3,等下个版本。不过仍然不建议这样使用。

@Leopoldthecoder
Copy link
Contributor

#1540 修复了初始值为对象时会报错的问题。

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

No branches or pull requests

3 participants