mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Calendar): incorrect height when position is left or right
This commit is contained in:
parent
11a5d44861
commit
3986536fcd
@ -168,6 +168,18 @@ export default {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Custom Position
|
||||||
|
|
||||||
|
Use `position` to custom popup position,can be set to `top`、`left`、`right`
|
||||||
|
|
||||||
|
```html
|
||||||
|
<van-calendar
|
||||||
|
v-model="show"
|
||||||
|
:round="false"
|
||||||
|
position="right"
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
### Tiled display
|
### Tiled display
|
||||||
|
|
||||||
Set `poppable` to `false`, the calendar will be displayed directly on the page instead of appearing as a popup
|
Set `poppable` to `false`, the calendar will be displayed directly on the page instead of appearing as a popup
|
||||||
|
@ -168,6 +168,18 @@ export default {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 自定义弹出位置
|
||||||
|
|
||||||
|
通过`position`属性自定义弹出层的弹出位置,可选值为`top`、`left`、`right`
|
||||||
|
|
||||||
|
```html
|
||||||
|
<van-calendar
|
||||||
|
v-model="show"
|
||||||
|
:round="false"
|
||||||
|
position="right"
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
### 平铺展示
|
### 平铺展示
|
||||||
|
|
||||||
将`poppable`设置为`false`,日历会直接展示在页面内,而不是以弹层的形式出现
|
将`poppable`设置为`false`,日历会直接展示在页面内,而不是以弹层的形式出现
|
||||||
|
@ -60,6 +60,13 @@
|
|||||||
:value="formatRange(date.customDayText)"
|
:value="formatRange(date.customDayText)"
|
||||||
@click="show('range', 'customDayText')"
|
@click="show('range', 'customDayText')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<van-cell
|
||||||
|
is-link
|
||||||
|
:title="$t('customPosition')"
|
||||||
|
:value="formatFullDate(date.customPosition)"
|
||||||
|
@click="show('single', 'customPosition')"
|
||||||
|
/>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
<demo-block :title="$t('tiledDisplay')">
|
<demo-block :title="$t('tiledDisplay')">
|
||||||
@ -77,8 +84,10 @@
|
|||||||
v-model="showCalendar"
|
v-model="showCalendar"
|
||||||
:type="type"
|
:type="type"
|
||||||
:color="color"
|
:color="color"
|
||||||
|
:round="round"
|
||||||
:min-date="minDate"
|
:min-date="minDate"
|
||||||
:max-date="maxDate"
|
:max-date="maxDate"
|
||||||
|
:position="position"
|
||||||
:formatter="formatter"
|
:formatter="formatter"
|
||||||
:show-confirm="showConfirm"
|
:show-confirm="showConfirm"
|
||||||
:confirm-text="confirmText"
|
:confirm-text="confirmText"
|
||||||
@ -108,6 +117,7 @@ export default {
|
|||||||
customRange: '自定义日期范围',
|
customRange: '自定义日期范围',
|
||||||
customConfirm: '自定义按钮文字',
|
customConfirm: '自定义按钮文字',
|
||||||
customDayText: '自定义日期文案',
|
customDayText: '自定义日期文案',
|
||||||
|
customPosition: '自定义弹出位置',
|
||||||
customCalendar: '自定义日历',
|
customCalendar: '自定义日历',
|
||||||
confirmDisabledText: '请选择结束时间',
|
confirmDisabledText: '请选择结束时间',
|
||||||
tiledDisplay: '平铺展示'
|
tiledDisplay: '平铺展示'
|
||||||
@ -127,6 +137,7 @@ export default {
|
|||||||
customRange: 'Custom Date Range',
|
customRange: 'Custom Date Range',
|
||||||
customConfirm: 'Custom Confirm Text',
|
customConfirm: 'Custom Confirm Text',
|
||||||
customDayText: 'Custom Day Text',
|
customDayText: 'Custom Day Text',
|
||||||
|
customPosition: 'Custom Position',
|
||||||
customCalendar: 'Custom Calendar',
|
customCalendar: 'Custom Calendar',
|
||||||
confirmDisabledText: 'Select End Time',
|
confirmDisabledText: 'Select End Time',
|
||||||
tiledDisplay: 'Tiled display'
|
tiledDisplay: 'Tiled display'
|
||||||
@ -143,12 +154,15 @@ export default {
|
|||||||
customColor: [],
|
customColor: [],
|
||||||
customConfirm: [],
|
customConfirm: [],
|
||||||
customRange: null,
|
customRange: null,
|
||||||
customDayText: []
|
customDayText: [],
|
||||||
|
customPosition: null
|
||||||
},
|
},
|
||||||
type: 'single',
|
type: 'single',
|
||||||
|
round: true,
|
||||||
color: undefined,
|
color: undefined,
|
||||||
minDate: undefined,
|
minDate: undefined,
|
||||||
maxDate: undefined,
|
maxDate: undefined,
|
||||||
|
position: undefined,
|
||||||
formatter: undefined,
|
formatter: undefined,
|
||||||
showConfirm: false,
|
showConfirm: false,
|
||||||
showCalendar: false,
|
showCalendar: false,
|
||||||
@ -161,9 +175,11 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
resetSettings() {
|
resetSettings() {
|
||||||
|
this.round = true;
|
||||||
this.color = undefined;
|
this.color = undefined;
|
||||||
this.minDate = undefined;
|
this.minDate = undefined;
|
||||||
this.maxDate = undefined;
|
this.maxDate = undefined;
|
||||||
|
this.position = undefined;
|
||||||
this.formatter = undefined;
|
this.formatter = undefined;
|
||||||
this.showConfirm = true;
|
this.showConfirm = true;
|
||||||
this.confirmText = undefined;
|
this.confirmText = undefined;
|
||||||
@ -197,6 +213,10 @@ export default {
|
|||||||
this.maxDate = new Date(2010, 4, 31);
|
this.maxDate = new Date(2010, 4, 31);
|
||||||
this.formatter = this.dayFormatter;
|
this.formatter = this.dayFormatter;
|
||||||
break;
|
break;
|
||||||
|
case 'customPosition':
|
||||||
|
this.round = false;
|
||||||
|
this.position = 'right';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -12,6 +12,11 @@
|
|||||||
height: @calendar-popup-height;
|
height: @calendar-popup-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.van-popup--left,
|
||||||
|
&.van-popup--right {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.van-popup__close-icon {
|
.van-popup__close-icon {
|
||||||
top: 13px;
|
top: 13px;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user