var lessons=new Vue({ el:"#lessons", data:{ lessons:[ {name:"英语", teacher: '赵六', id:1,checked:true}, {name:"数学", teacher: '王五', id:2,checked:true}, {name:"语文", teacher: '李四', id:3,checked:true}, {name:"233", teacher: '张三', id:4,checked:true}, ] }, methods: { onMouseEnter: function (id) { console.log(id) }, onMouseLeave: function () { } }, computed:{ selectAll:{ get:function(){ return this.$data.lessons.every(function(x){ return x.checked==true }) }, set:function(checked){ this.$data.lessons.map(function(x){x.checked=checked}) } } } })