交互式爱情
可以呀,把绑定字体颜色,和图标就行了,类似于<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <style> .active{ background: red; } </style> </head> <body> <div id="box"> <ul> <li v-for="(item,index) in items" @click="selected(index)" :class="{active: activeindex == index}"> {{item.text}} </li> </ul> </div> <script src="vue.js"></script> <script> var vm = new Vue({ el:"#box", data:{ items:[{id:1,text:"aaa"},{id:2,text:"bbb"},{id:3,text:"ccc"},{id:4,text:"ddd"}], activeindex:"-1" }, methods:{ selected:function(index){ this.activeindex = index; } } }) </script> </body></html>