您现在的位置是:首页 > 网站制作 > vue.js心得vue.js心得
vue 过滤,筛选 数组
蒙xs2021-03-26【vue.js心得】人已围观
简介vue过滤
const arr = [
{
name: 'tom1',
age: 23
},
{
name: 'tom2',
age: 42
},
{
name: 'tom3',
age: 17
},
{
name: 'tom4',
age: 13
},
]
const res = arr.filter(item => item.age > 18);
console.log(res);
console.log(arr);
{
name: 'tom1',
age: 23
},
{
name: 'tom2',
age: 42
},
{
name: 'tom3',
age: 17
},
{
name: 'tom4',
age: 13
},
]
const res = arr.filter(item => item.age > 18);
console.log(res);
console.log(arr);
方法2
let res = [{name:1},{name:2},{name:3}]
let es = res.filter(item=>item.name > 2 )
console.log(es);
let es = res.filter(item=>item.name > 2 )
console.log(es);
转至https://blog.csdn.net/qq_43363884/article/details/105582631
很赞哦! ()
下一篇:使用day.js格式化时间