Merge branch '2.x' into dev
This commit is contained in:
@@ -334,9 +334,10 @@ Following props are supported when the type is multiple
|
||||
|
||||
Use [ref](https://v3.vuejs.org/guide/component-template-refs.html) to get Calendar instance and call instance methods.
|
||||
|
||||
| Name | Description | Attribute | Return value |
|
||||
| ----- | ----------------------------------- | --------- | ------------ |
|
||||
| reset | Reset selected date to default date | - | - |
|
||||
| Name | Description | Attribute | Return value |
|
||||
| --- | --- | --- | --- |
|
||||
| reset | Reset selected date to default date | - | - |
|
||||
| scrollToDate `v2.12.2` | Scroll to date | _date: Date_ | - |
|
||||
|
||||
### Less Variables
|
||||
|
||||
|
||||
@@ -340,9 +340,10 @@ export default {
|
||||
|
||||
通过 ref 可以获取到 Calendar 实例并调用实例方法,详见[组件实例方法](#/zh-CN/advanced-usage#zu-jian-shi-li-fang-fa)。
|
||||
|
||||
| 方法名 | 说明 | 参数 | 返回值 |
|
||||
| ------ | ---------------------- | ---- | ------ |
|
||||
| reset | 重置选中的日期到默认值 | - | - |
|
||||
| 方法名 | 说明 | 参数 | 返回值 |
|
||||
| ---------------------- | ---------------------- | ------------ | ------ |
|
||||
| reset | 重置选中的日期到默认值 | - | - |
|
||||
| scrollToDate `v2.12.2` | 滚动到某个日期 | _date: Date_ | - |
|
||||
|
||||
### 样式变量
|
||||
|
||||
|
||||
+17
-20
@@ -267,27 +267,8 @@ export default createComponent({
|
||||
}
|
||||
};
|
||||
|
||||
// scroll to current month
|
||||
const scrollIntoView = () => {
|
||||
const scrollToDate = (targetDate) => {
|
||||
raf(() => {
|
||||
const displayed = props.show || !props.poppable;
|
||||
if (!displayed) {
|
||||
return;
|
||||
}
|
||||
|
||||
onScroll();
|
||||
|
||||
const { currentDate } = state;
|
||||
if (!currentDate) {
|
||||
return;
|
||||
}
|
||||
|
||||
const targetDate =
|
||||
props.type === 'single' ? currentDate : currentDate[0];
|
||||
if (!targetDate) {
|
||||
return;
|
||||
}
|
||||
|
||||
months.value.some((month, index) => {
|
||||
if (compareMonth(month, targetDate) === 0) {
|
||||
monthRefs.value[index].scrollIntoView(bodyRef.value);
|
||||
@@ -301,6 +282,22 @@ export default createComponent({
|
||||
});
|
||||
};
|
||||
|
||||
// scroll to current month
|
||||
const scrollIntoView = () => {
|
||||
if (props.poppable && !props.show) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { currentDate } = state;
|
||||
if (currentDate) {
|
||||
const targetDate =
|
||||
props.type === 'single' ? currentDate : currentDate[0];
|
||||
scrollToDate(targetDate);
|
||||
} else {
|
||||
raf(onScroll);
|
||||
}
|
||||
};
|
||||
|
||||
const init = () => {
|
||||
if (props.poppable && !props.show) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user