首页 > 关于vue.js的class问题

关于vue.js的class问题


如上图,我分页器引用的css库,page-item是固定的class,右边的active也一样,就是点击后背景变色,我想做的就是根据currentPage来动态更改active,这里的currentPage初始为1,该怎么写?
"active":currentPage==index写法也没反应


如果你是需要“当前页码等于index时给这个item加active样式”的话,那你应该这么写啊:

<xxx :class="['page-item', {active: currentPage === index}]">
【热门文章】
【热门文章】