mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:48:55 +08:00
feat:增加年选择组件 (#1288)
This commit is contained in:
parent
968364f87f
commit
9350067327
27
docs/components/form/year.md
Normal file
27
docs/components/form/year.md
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
title: Year 年
|
||||
description:
|
||||
type: 0
|
||||
group: null
|
||||
menuName: Year 年
|
||||
icon:
|
||||
order: 61
|
||||
---
|
||||
|
||||
## 基本用法
|
||||
|
||||
```schema:height="400" scope="body"
|
||||
{
|
||||
"type": "form",
|
||||
"api": "https://houtai.baidu.com/api/mock2/form/saveForm",
|
||||
"controls": [
|
||||
{
|
||||
"type": "year",
|
||||
"name": "year",
|
||||
"label": "年"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
更多用法和配置可以参考 [Date 日期](date),year 就是 data 的特定配置,所以 data 的所有配置都能使用。
|
@ -692,6 +692,15 @@ export const docs = [
|
||||
import('../../docs/components/form/treeselect.md').then(
|
||||
makeMarkdownRenderer
|
||||
)
|
||||
},
|
||||
{
|
||||
label: 'Year 年',
|
||||
path: '/docs/components/form/year',
|
||||
getComponent: () =>
|
||||
// @ts-ignore
|
||||
import('../../docs/components/form/year.md').then(
|
||||
makeMarkdownRenderer
|
||||
)
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -343,3 +343,18 @@ export class MonthControlRenderer extends DateControl {
|
||||
closeOnSelect: true
|
||||
};
|
||||
}
|
||||
|
||||
@FormItem({
|
||||
type: 'year'
|
||||
})
|
||||
export class YearControlRenderer extends DateControl {
|
||||
static defaultProps = {
|
||||
...DateControl.defaultProps,
|
||||
placeholder: '请选择年',
|
||||
inputFormat: 'YYYY',
|
||||
dateFormat: 'YYYY',
|
||||
timeFormat: '',
|
||||
viewMode: 'years',
|
||||
closeOnSelect: true
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user