数组得过滤
选择对应得用户到数组里面
this.selectData.push(row);
//数组对象去重 es6 https://blog.csdn.net/love_life_forever/article/details/107967487
this.selectData = this.selectData.filter((element, index, self) => {
return self.findIndex((x) => x.nickName === element.nickName) === index;
});
删除多选择得对应项目
arr.push(row.userId);
this.selectData = this.selectData.filter(
(item) => !arr.includes(item.userId)
);xml
数组得遍历加条件
this.eventXZ.forEach((value, index, array) => {
if (value.dictLabel !== "变更") {
this.arrNew.push(value);
}
});
数组v-for遍历
v-for="item in roleOptions"
:key="item.roleId"
:label="item.roleName"
:value="item.roleCode"
:disabled="item.status == 1"
多个数组合并一个数组
this.form.annex = [...this.Universal, ...this.construction, ...this.performance]
JSON.stringify() 与 JSON.parse 操作
JSON.stringify() 从一个对象中解析出字符串
JSON.stringify({“a”:“1”,“b”:“2”})
结果是:“{“a”:“1”,“b”:“2”}”
JSON.parse()从一个字符串中解析出JSON对象
var str = ‘{“a”:“1”,“b”:“2”}’;
JSON.parse(str);
结果是:Object{a:“1”,b:“2”}