text1:<li v-for="dat in data1 | filterBy '' in 'name' " >
<span v-for="(key,value) in dat" >{{key}}:{{value}}</span></li>text2:<li v-for="dat in data1" v-if=dat.name >
<span v-for="(key,value) in dat" >{{key}}:{{value}}</span>
</li>data:var data1 =[
{name:"kit",age:18},
{name:"aidewar",age:23},
{name:"zhangsan",age:46},
{name:"lisi",age:28},
{named:"lisiww",age:28}
];上面这两种方法都能筛选出有字段name的对象,最后一条数据不会被显示。只是不太明白这两种方法哪个更好?请大神赐教
添加回答
举报
0/150
提交
取消