Commit 6f874a8a by Jaxon

feat(libs): 新增 setAllOptions 函数为下拉选项添加“全部”项

1 parent fccefd06
/**
* 传入 存放 options的数组, 把所有 第一项 不是 "" 的, 添加第一项, 然后设置 label为 全部
* @param {*} list 存放 options的数组
*/
export function setAllOptions(list) {
list.forEach((item, index) => {
if (item.type === "select") {
if (item.optionList[0][item.optionLabel] !== "全部") {
item.optionList.unshift({
[item.optionId]: "",
[item.optionLabel]: "全部",
});
}
}
});
return list;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!