如何检查双 v-for 和 if 在两者中,然后更改样式


<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

如何显示所有会员资格,并且仅显示属于绿色的会员资格?所有其他的都应该涂成红色...


<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>

你能这样试试吗

相关内容

  • 没有找到相关文章