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! #36

Closed
Zzeo opened this issue Nov 3, 2017 · 5 comments
Closed

一个小bug! #36

Zzeo opened this issue Nov 3, 2017 · 5 comments

Comments

@Zzeo
Copy link

Zzeo commented Nov 3, 2017

image
表格是隔行变色的, 鼠标悬停颜色变化! 但是当连续几条空数据时,鼠标悬停的效果如下:
image

@huangshuwei
Copy link
Collaborator

huangshuwei commented Nov 3, 2017

我试了下不会啊,看我写的测试:
https://jsfiddle.net/huangsw/d6caqzw3/

你隔行变色用的是内置的api吗,还是自己实现的?

@Zzeo
Copy link
Author

Zzeo commented Nov 3, 2017

是用的内置api, 有一条用于渲染表格的数据data, 然后在mounted里面对数据二次加工,(push两条空数据之后), 就会出现那样的问题
image

@huangshuwei
Copy link
Collaborator

给数组对象通过push添加新属性会破坏对象的响应式
参考这里:
https://vuefe.cn/v2/api/#Vue-set

要么通过这种方式也可以
this.data = [...]

@huangshuwei
Copy link
Collaborator

我还是不太喜欢官方推荐的this.$set方式,但是有些情况下必须那么做。像你这个问题你可以通过对象赋值的方式做。看这个:
https://jsfiddle.net/huangsw/d6caqzw3/1/

@huangshuwei
Copy link
Collaborator

问题解决了没,先关掉了,有问题再反馈

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

2 participants