gpt4 book ai didi

javascript - 如何检查双 v-for 和 if 都在则更改样式

转载 作者:行者123 更新时间:2023-11-28 03:30:06 25 4
gpt4 key购买 nike

<div v-for="memberMembershipyear in memberMembershipyears">
<li v-for="membershipYear in membershipYears"
:style="membershipYear.num === memberMembershipyear.num ? 'color:green' : color:red'">
{{membershipYear.membershipType}} {{membershipYear.yr}}
</li>
</div>

这并没有像我预期的那样工作,向我展示了这样的一切。大部分是红色,也有一些是绿色。它重复了很长时间。我也尝试过 v-once,但没有成功。

 Membership of club 2001
Membership of club 2002
Membership of club 2003
Membership of club 2004
Membership of club 2006
Membership of club 2007
Membership of club 2009
Membership of club 2010
Membership of club 2012
Membership of club 2013
Membership of club 2014
Membership of club 2015
Membership of club 2017
Membership of club 2018
Membership of club 2019
Membership of club 2020
Membership of club 2001
Membership of club 2002
Membership of club 2003
Membership of club 2004
Membership of club 2006
Membership of club 2007
Membership of club 2009
Membership of club 2010
Membership of club 2012
Membership of club 2013
Membership of club 2014
Membership of club 2015
Membership of club 2017
Membership of club 2018
Membership of club 2019
Membership of club 2020
Membership of club 2001
Membership of club 2002
Membership of club 2003
Membership of club 2004
Membership of club 2006
Membership of club 2007
Membership of club 2009
Membership of club 2010
Membership of club 2012
Membership of club 2013
Membership of club 2014
Membership of club 2015
Membership of club 2017
Membership of club 2018
Membership of club 2019
Membership of club 2020
Membership of club 2001
Membership of club 2002
Membership of club 2003
Membership of club 2004
Membership of club 2006
Membership of club 2007
Membership of club 2009
Membership of club 2010
Membership of club 2012
Membership of club 2013
Membership of club 2014
Membership of club 2015
Membership of club 2017
Membership of club 2018
Membership of club 2019
Membership of club 2020
Membership of club 2001
Membership of club 2002
Membership of club 2003
Membership of club 2004
Membership of club 2006
Membership of club 2007
Membership of club 2009
Membership of club 2010
Membership of club 2012
Membership of club 2013
Membership of club 2014
Membership of club 2015
Membership of club 2017
Membership of club 2018
Membership of club 2019
Membership of club 2020
Membership of club 2001
Membership of club 2002
Membership of club 2003
Membership of club 2004
Membership of club 2006
Membership of club 2007
Membership of club 2009
Membership of club 2010
Membership of club 2012
Membership of club 2013
Membership of club 2014
Membership of club 2015
Membership of club 2017
Membership of club 2018
Membership of club 2019
Membership of club 2020
Membership of club 2001
Membership of club 2002
Membership of club 2003
Membership of club 2004
Membership of club 2006
Membership of club 2007
Membership of club 2009
Membership of club 2010
Membership of club 2012
Membership of club 2013
Membership of club 2014
Membership of club 2015
Membership of club 2017
Membership of club 2018
Membership of club 2019
Membership of club 2020

我如何显示所有成员(member)资格以及仅显示绿色成员(member)资格?所有其他应涂成红色...

最佳答案


<div v-for="memberMembershipyear in memberMembershipyears">
<li v-for="membershipYear in membershipYears"
:style="membershipYear.num === memberMembershipyear.num ? 'color:green' : 'color:red'">
{{membershipYear.membershipType}} {{membershipYear.yr}}
</li>
</div>

你可以这样尝试吗

关于javascript - 如何检查双 v-for 和 if 都在则更改样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58257561/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com