<div id='app'>
answer:
<li v-for="item in enumbable">{{item}}</li>
</div>
<script>
var vm = new Vue({
el:'#app',
data:{
lists:[2,1,3,4,5,6,7,8]
},
computed:{
enumbable:function(){
return this.lists.filter(function(value){
return value % 2 === 0
})
}
}
})
来源:CSDN
作者:交大彭于晏
链接:https://blog.csdn.net/weixin_42191575/article/details/104572973