采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
:class="{'current':currentIndex === $index}",这段代码不起作用,我用的vue2.0 。求解答
2.0索引不能用$index
循环 v-for="(item, index) in items"
使用 :class="{'current':currentIndex === index}"
建议看一下官方的迁移文档
<li v-for="(item,index) in goods" :key="index" class="menu-item" :class="{'current':currentIndex===index}">
vue2.0这样写
登录后可查看更多问答,登录/注册
掌握Vue1.0到2.0再到2.5最全版本应用与迭代,打造极致流畅的WebApp
2.4k 21
1.0k 21
1.2k 20
1.1k 18
1.3k 17