mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Calendar): add position prop
This commit is contained in:
parent
8dea26db95
commit
956800b95c
@ -196,6 +196,7 @@ Set `poppable` to `false`, the calendar will be displayed directly on the page i
|
|||||||
| default-date | Default selected date | *Date \| Date[]* | Today | - |
|
| default-date | Default selected date | *Date \| Date[]* | Today | - |
|
||||||
| row-height | Row height | *number* | `64` | - |
|
| row-height | Row height | *number* | `64` | - |
|
||||||
| formatter | Day formatter | *(day: Day) => Day* | - | - |
|
| formatter | Day formatter | *(day: Day) => Day* | - | - |
|
||||||
|
| position | Popup position, can be set to `top` `right` `left` | *string* | `bottom` | - |
|
||||||
| poppable | Whether to show the calendar inside a popup | *boolean* | `true` | - |
|
| poppable | Whether to show the calendar inside a popup | *boolean* | `true` | - |
|
||||||
| show-mark | Whether to show background month mark | *boolean* | `true` | - |
|
| show-mark | Whether to show background month mark | *boolean* | `true` | - |
|
||||||
| show-confirm | Whether to show confirm button | *boolean* | `true` | - |
|
| show-confirm | Whether to show confirm button | *boolean* | `true` | - |
|
||||||
|
@ -196,6 +196,7 @@ export default {
|
|||||||
| default-date | 默认选中的日期 | *Date \| Date[]* | 今天 | - |
|
| default-date | 默认选中的日期 | *Date \| Date[]* | 今天 | - |
|
||||||
| row-height | 日期行高 | *number* | `64` | - |
|
| row-height | 日期行高 | *number* | `64` | - |
|
||||||
| formatter | 日期格式化函数 | *(day: Day) => Day* | - | - |
|
| formatter | 日期格式化函数 | *(day: Day) => Day* | - | - |
|
||||||
|
| position | 弹出位置,可选值为 `top` `right` `left` | *string* | `bottom` | - |
|
||||||
| poppable | 是否以弹层的形式展示日历 | *boolean* | `true` | - |
|
| poppable | 是否以弹层的形式展示日历 | *boolean* | `true` | - |
|
||||||
| show-mark | 是否显示月份背景水印 | *boolean* | `true` | - |
|
| show-mark | 是否显示月份背景水印 | *boolean* | `true` | - |
|
||||||
| show-confirm | 是否展示确认按钮 | *boolean* | `true` | - |
|
| show-confirm | 是否展示确认按钮 | *boolean* | `true` | - |
|
||||||
|
@ -41,6 +41,10 @@ export default createComponent({
|
|||||||
return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
|
return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
position: {
|
||||||
|
type: String,
|
||||||
|
default: 'bottom'
|
||||||
|
},
|
||||||
rowHeight: {
|
rowHeight: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: ROW_HEIGHT
|
default: ROW_HEIGHT
|
||||||
@ -307,9 +311,9 @@ export default createComponent({
|
|||||||
<Popup
|
<Popup
|
||||||
round
|
round
|
||||||
closeable
|
closeable
|
||||||
value={this.value}
|
|
||||||
position="bottom"
|
|
||||||
class={bem('popup')}
|
class={bem('popup')}
|
||||||
|
value={this.value}
|
||||||
|
position={this.position}
|
||||||
onInput={this.togglePopup}
|
onInput={this.togglePopup}
|
||||||
>
|
>
|
||||||
{this.genCalendar()}
|
{this.genCalendar()}
|
||||||
|
@ -7,7 +7,10 @@
|
|||||||
background-color: @calendar-background-color;
|
background-color: @calendar-background-color;
|
||||||
|
|
||||||
&__popup {
|
&__popup {
|
||||||
height: @calendar-popup-height;
|
&.van-popup--top,
|
||||||
|
&.van-popup--bottom {
|
||||||
|
height: @calendar-popup-height;
|
||||||
|
}
|
||||||
|
|
||||||
.van-popup__close-icon {
|
.van-popup__close-icon {
|
||||||
top: 13px;
|
top: 13px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user