mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-02-02 18:08:40 +08:00
feat(api-select): added numberToString prop #200
This commit is contained in:
parent
b45f8c5021
commit
5d51d48787
@ -1,3 +1,15 @@
|
||||
## Wip
|
||||
|
||||
### ✨ Features
|
||||
|
||||
- `ApiSelect`新增 `numberToString`属性,用于将 value 为`number`的值全部转化为`string`
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- 修复 modal 高度计算错误
|
||||
- 修复菜单折叠状态下点击标签页弹出菜单
|
||||
- 修复 form 表单初始化值为 0 问题
|
||||
|
||||
## 2.0.0-rc.17 (2020-01-18)
|
||||
|
||||
### ✨ Refactor
|
||||
|
@ -36,6 +36,7 @@
|
||||
},
|
||||
props: {
|
||||
value: propTypes.string,
|
||||
numberToString: propTypes.bool,
|
||||
api: {
|
||||
type: Function as PropType<(arg?: Recordable) => Promise<OptionsItem[]>>,
|
||||
default: null,
|
||||
@ -61,13 +62,14 @@
|
||||
const [state] = useRuleFormItem(props);
|
||||
|
||||
const getOptions = computed(() => {
|
||||
const { labelField, valueField } = props;
|
||||
const { labelField, valueField, numberToString } = props;
|
||||
|
||||
return unref(options).reduce((prev, next: Recordable) => {
|
||||
if (next) {
|
||||
const value = next[valueField];
|
||||
prev.push({
|
||||
label: next[labelField],
|
||||
value: next[valueField],
|
||||
value: numberToString ? `${value}` : value,
|
||||
});
|
||||
}
|
||||
return prev;
|
||||
|
Loading…
Reference in New Issue
Block a user