var list = [
{
"name": "花",
"index": 10,
"len": 4,
"left": 150,
"bottom": 108
},
{
"name": "花",
"index": 0,
"len": 4,
"left": 150,
"bottom": 0
},
{
"name": "花",
"index": 8,
"len": 4,
"left": 950,
"bottom": 0
},
{
"name": "草",
"index": 14,
"len": 4,
"left": 550,
"bottom": 108
},
{
"name": "草",
"index": 15,
"len": 4,
"left": 650,
"bottom": 108
},
{
"name": "草",
"index": 15,
"len": 4,
"left": 650,
"bottom": 108
}
];
var aa = '花花草草';
vue中需要写一个通用的方法,当aa这个词跟list中各项的name值相等时,name置空,最后得到的list是
list = [
{
"name": "花",
"index": 10,
"len": 4,
"left": 150,
"bottom": 108
},
{
"name": "",
"index": 0,
"len": 4,
"left": 150,
"bottom": 0
},
{
"name": "",
"index": 8,
"len": 4,
"left": 950,
"bottom": 0
},
{
"name": "",
"index": 14,
"len": 4,
"left": 550,
"bottom": 108
},
{
"name": "",
"index": 15,
"len": 4,
"left": 650,
"bottom": 108
},
{
"name": "草",
"index": 15,
"len": 4,
"left": 650,
"bottom": 108
}
];
就是把list中的name值连接起来跟aa值相等时置空的方法