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

v-for首元素样式错位 #3491

Closed
zhujz opened this issue Aug 22, 2016 · 6 comments
Closed

v-for首元素样式错位 #3491

zhujz opened this issue Aug 22, 2016 · 6 comments

Comments

@zhujz
Copy link

zhujz commented Aug 22, 2016

A BUG
version: v2.0.0-rc.3

- 当我使用v-for的时候,如果v-for外面没有被一个标签包起来(即有兄弟标签),那么v-for中第一个元素就会被其他标签样式干扰(看起来是变得和下方某标签样式相同,而且只受该标签行内style影响);
- 如果用一个div将v-for的标签包起来,就不会出现问题;
- 之前的版本我使用的是v2.0.0-beta.5,换到最新版v2.0.0-rc.3依然有问题,用v1.0.10测试没有问题;

如果需要最小化复现,我再去搞一下。

@fnlctrl
Copy link
Member

fnlctrl commented Aug 22, 2016

需要最小化复现,请去搞一下。

@zhujz
Copy link
Author

zhujz commented Aug 22, 2016

@rajibahmed
Copy link

rajibahmed commented Aug 22, 2016

<div id="demo">
  <div class="a" v-for="item in list">{{item.name}}</div>
  <div v-show="test"></div>
</div>

Works ! need to remove extra

@zhujz
Copy link
Author

zhujz commented Aug 23, 2016

It's just minimized, not extra.It can't be removed.
The only way I found to solve it like this https://jsfiddle.net/mbwLoLo9/15/.
But I don't know the reason.

@fnlctrl
Copy link
Member

fnlctrl commented Aug 23, 2016

@yyx990803 Looks like a bug to me: v-show is affecting sibling elements, as in #3491 (comment)

@zhujz
Copy link
Author

zhujz commented Aug 23, 2016

@fnlctrl 还有个线索,不只是v-show,之前我试过用行内style也会影响循环首元素,但是复现不出来了,出问题的条件不一样

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

4 participants