提交 5d51d487 编写于 作者: V vben

feat(api-select): added numberToString prop #200

上级 b45f8c50
## 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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册