今天讲下怎么给下拉框的值去重复
<el-select v-model="postData" style="width:220px;" multiple collapse-tags placeholder="请选择岗位">
<el-option
v-for="item in postOptions"
:label="item.post_name"
:value="item.post_name"
/>
</el-select>
js:
var tempData =res.data.list;
var hash = {};
tempData = tempData.reduce(function (item, next) {
hash[next.post_name] ? '' : hash[next.post_name] = true && item.push(next);
return item;
}, []);
self.postOptions = tempData;
ok~