Merge branch '2.x' into dev

This commit is contained in:
chenjiahan
2021-01-02 17:20:30 +08:00
8 changed files with 50 additions and 35 deletions
+4 -3
View File
@@ -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
+4 -3
View File
@@ -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
View File
@@ -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;
+8
View File
@@ -102,6 +102,14 @@ export default {
| ------- | -------------------------------- |
| default | 锚点位置显示内容,默认为索引字符 |
### IndexBar 方法
通过 ref 可以获取到 IndexBar 实例并调用实例方法,详见[组件实例方法](#/zh-CN/advanced-usage#zu-jian-shi-li-fang-fa)。
| 方法名 | 说明 | 参数 | 返回值 |
| ------------------ | -------------- | ------------------------- | ------ |
| scrollTo `v2.12.2` | 滚动到指定锚点 | _index: number \| string_ | - |
### 样式变量
组件提供了下列 Less 变量,可用于自定义样式,使用方法请参考[主题定制](#/zh-CN/theme)。
+8 -8
View File
@@ -78,14 +78,14 @@ app.use(Loading);
### Props
| 参数 | 说明 | 类型 | 默认值 |
| ---------- | ---------------------------- | ------------------ | ---------- |
| color | 颜色 | _string_ | `#c9c9c9` |
| type | 类型,可选值为 `spinner` | _string_ | `circular` |
| size | 加载图标大小,默认单位为`px` | _number \| string_ | `30px` |
| text-size | 文字大小,默认单位为`px` | _number \| string_ | `14px` |
| text-color | 文字颜色 | _string_ | `#c9c9c9` |
| vertical | 是否垂直排列图标和文字内容 | _boolean_ | `false` |
| 参数 | 说明 | 类型 | 默认值 |
| ---------- | ----------------------------- | ------------------ | ---------- |
| color | 颜色 | _string_ | `#c9c9c9` |
| type | 类型,可选值为 `spinner` | _string_ | `circular` |
| size | 加载图标大小,默认单位为 `px` | _number \| string_ | `30px` |
| text-size | 文字大小,默认单位为 `px` | _number \| string_ | `14px` |
| text-color | 文字颜色 | _string_ | `#c9c9c9` |
| vertical | 是否垂直排列图标和文字内容 | _boolean_ | `false` |
### Slots