未验证 提交 fa7c54fb 编写于 作者: L lkjh3214 提交者: GitHub

fix(calendar): 新增初始化位置方法 (#2083)

* feat: 添加range组件、calendar组件在线文档

* fix: 文档调整

* fix: 重构calendar组件

* feat: 日历组件重构,文档修改,功能完善

* fix: 格式化

* fix: 代码格式化调整。

* fix: 去除无用代码

* fix: 文档调整

* fix:  文档调整

* fix: taro  demo 样式修改

* feat: range组件功能完善,新增 竖向操作,刻度展示。

* fix: 冲突解决

* feat: taro功能新增,兼容处理,文档修改

* feat: 添加range组件,jdt主题色

* fix: 修改组件初始化逻辑

* feat: 新增h5 日期多选功能

* feat: taro版本添加 日期多选功能

* fix: 修复多选,无法选中开头结尾日期问题

* fix: 文档修改,添加en-US 文档

* fix: 文档完善

* fix: calendar,demo错误修复

* fix: swiper文档修改

* fix: 日历组件问题修复

* fix: calendar taro兼容问题调整

* fix: taro转h5问题修改

* fix: 日历组件修改,vite配置修改,新增plugin

* fix: 配置项修改

* fix: 指定taro版本

* fix: taro版本指定为3.5.6

* fix: 修复scroll-view标签问题

* feat: 日历组件,暴露初始化定位方法

* fix: 修改文档,调整全局样式

* fix: calendar 文档修改

---------
Co-authored-by: Nlkjh3214 <13121007159@163.com>
Co-authored-by: Nlove_forever <1039168735@qq.com>
上级 fe3deeab
......@@ -643,3 +643,4 @@ Through [ref](https://vuejs.org/guide/essentials/template-refs.html), you can ge
| Name | Description | Arguments |
|--------|------------------|---------------|
| scrollToDate | Scroll to the month of the specified date | string:'2021-12-30' |
| initPosition`v3.3.4` | Initialize scroll position | |
......@@ -636,3 +636,4 @@ export default {
| 方法名 | 说明 | 参数 |
|--------|------------------|---------------|
| scrollToDate | 滚动到指定日期所在月 | string:'2021-12-30' |
| initPosition`v3.3.4` | 初始化滚动位置 | 无 |
......@@ -184,8 +184,12 @@ export default create({
const scrollToDate = (date: string) => {
calendarRef.value?.scrollToDate(date);
};
const initPosition = () => {
calendarRef.value?.initPosition();
};
useExpose({
scrollToDate
scrollToDate,
initPosition
});
// methods
const update = () => {
......
......@@ -183,8 +183,12 @@ export default create({
const scrollToDate = (date: string) => {
calendarRef.value?.scrollToDate(date);
};
const initPosition = () => {
calendarRef.value?.initPosition();
};
useExpose({
scrollToDate
scrollToDate,
initPosition
});
// methods
const update = () => {
......
......@@ -623,9 +623,8 @@ export default create({
let containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
state.containerHeight = `${containerHeight}px`;
state.scrollTop = Math.ceil(state.monthsData[state.currentIndex].cssScrollHeight);
initPosition();
state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
if (months?.value) {
viewHeight.value = months.value.clientHeight;
}
......@@ -691,8 +690,12 @@ export default create({
}
});
};
const initPosition = () => {
state.scrollTop = Math.ceil(state.monthsData[state.currentIndex].cssScrollHeight);
};
useExpose({
scrollToDate
scrollToDate,
initPosition
});
const setDefaultRange = (monthsNum: number, current: number) => {
let rangeArr: any[] = [];
......
......@@ -632,7 +632,7 @@ export default create({
if (months?.value && monthsPanel?.value && viewArea?.value) {
viewHeight.value = months.value.clientHeight;
monthsPanel.value.style.height = `${containerHeight}px`;
months.value.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
initPosition();
}
});
state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
......@@ -671,8 +671,14 @@ export default create({
}
});
};
const initPosition = () => {
if (months?.value) {
months.value.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
}
};
useExpose({
scrollToDate
scrollToDate,
initPosition
});
// 设置当前可见月份
const setDefaultRange = (monthsNum: number, current: number) => {
......
......@@ -8,7 +8,7 @@ page,
overflow-x: hidden;
overflow-y: auto;
padding: 0 17px 17px 17px;
box-sizing: border-box;
&.full {
padding: 0 0 0 0;
h2 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册