​:class="{'current':currentIndex === $index}"

来源:17-8 better-scroll运用(3)

墨墨2号

2016-12-30

:class="{'current':currentIndex === $index}",这段代码不起作用,我用的vue2.0 。求解答

写回答

2回答

点点无眠

2016-12-30

2.0索引不能用$index

循环 v-for="(item, index) in items"

使用 :class="{'current':currentIndex === index}"

建议看一下官方的迁移文档

3
0

trinidy

2018-04-17

<li v-for="(item,index) in goods" :key="index" class="menu-item" :class="{'current':currentIndex===index}"> 

vue2.0这样写

0
0

Vue.js2.5+cube-ui重构饿了么App(经典再升级)

掌握Vue1.0到2.0再到2.5最全版本应用与迭代,打造极致流畅的WebApp

9868 学习 · 4162 问题

查看课程