Showing
3 changed files
with
9 additions
and
2 deletions
| @@ -22,6 +22,8 @@ export struct ENewspaperPageComponent { | @@ -22,6 +22,8 @@ export struct ENewspaperPageComponent { | ||
| 22 | @State calendarDate: string = '' | 22 | @State calendarDate: string = '' |
| 23 | private swiperController: SwiperController = new SwiperController() | 23 | private swiperController: SwiperController = new SwiperController() |
| 24 | @State swiperIndex: number = 0; | 24 | @State swiperIndex: number = 0; |
| 25 | + //当前选择的日期标记 | ||
| 26 | + @State selectDate: Date = new Date() | ||
| 25 | 27 | ||
| 26 | //watch监听报纸页码回调 | 28 | //watch监听报纸页码回调 |
| 27 | onCurrentPageNumUpdated(): void { | 29 | onCurrentPageNumUpdated(): void { |
| @@ -34,6 +36,7 @@ export struct ENewspaperPageComponent { | @@ -34,6 +36,7 @@ export struct ENewspaperPageComponent { | ||
| 34 | //日历选择弹框 | 36 | //日历选择弹框 |
| 35 | calendarDialogController: CustomDialogController = new CustomDialogController({ | 37 | calendarDialogController: CustomDialogController = new CustomDialogController({ |
| 36 | builder: ENewspaperCalendarDialog({ | 38 | builder: ENewspaperCalendarDialog({ |
| 39 | + selectDate: this.selectDate, | ||
| 37 | onDateChange: (date: RMCalendarBean) => { | 40 | onDateChange: (date: RMCalendarBean) => { |
| 38 | console.log("onDateChange-日历选择弹框", "date:", JSON.stringify(date)) | 41 | console.log("onDateChange-日历选择弹框", "date:", JSON.stringify(date)) |
| 39 | if (date.fullYear && date.month && date.date) { | 42 | if (date.fullYear && date.month && date.date) { |
| @@ -41,6 +44,7 @@ export struct ENewspaperPageComponent { | @@ -41,6 +44,7 @@ export struct ENewspaperPageComponent { | ||
| 41 | this.calendarDate = `${date.fullYear}-${month > 9 ? month : '0' + month}-${date.date > 9 ? date.date : '0' + date.date}` | 44 | this.calendarDate = `${date.fullYear}-${month > 9 ? month : '0' + month}-${date.date > 9 ? date.date : '0' + date.date}` |
| 42 | this.getNewspaperTime() | 45 | this.getNewspaperTime() |
| 43 | this.getNewspaperList() | 46 | this.getNewspaperList() |
| 47 | + this.selectDate = new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0) | ||
| 44 | } | 48 | } |
| 45 | } | 49 | } |
| 46 | }), | 50 | }), |
| @@ -6,11 +6,14 @@ export struct ENewspaperCalendarDialog { | @@ -6,11 +6,14 @@ export struct ENewspaperCalendarDialog { | ||
| 6 | calendarDialogController?: CustomDialogController | 6 | calendarDialogController?: CustomDialogController |
| 7 | // 选择变化监听, | 7 | // 选择变化监听, |
| 8 | onDateChange?: (date: RMCalendarBean) => void | 8 | onDateChange?: (date: RMCalendarBean) => void |
| 9 | + //当前选择的日期标记 | ||
| 10 | + @Prop selectDate: Date = new Date() | ||
| 9 | 11 | ||
| 10 | build() { | 12 | build() { |
| 11 | RMCalendar({ | 13 | RMCalendar({ |
| 12 | // 开始日期 | 14 | // 开始日期 |
| 13 | startDate: new Date(2000, 1, 1), | 15 | startDate: new Date(2000, 1, 1), |
| 16 | + selectDay: this.selectDate, | ||
| 14 | // 截止日期 | 17 | // 截止日期 |
| 15 | endDate: new Date(), | 18 | endDate: new Date(), |
| 16 | // 日期选择变化监听 | 19 | // 日期选择变化监听 |
| @@ -32,8 +32,8 @@ export struct ENewspaperListDialog { | @@ -32,8 +32,8 @@ export struct ENewspaperListDialog { | ||
| 32 | console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) | 32 | console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) |
| 33 | let _scrollIndex = Number.parseInt(this.currentPageNum) | 33 | let _scrollIndex = Number.parseInt(this.currentPageNum) |
| 34 | console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_scrollIndex:", _scrollIndex) | 34 | console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_scrollIndex:", _scrollIndex) |
| 35 | - this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex | ||
| 36 | - this.listScroller.scrollToIndex(this.scrollIndex) | 35 | + let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex |
| 36 | + this.listScroller.scrollToIndex(scrollIndexEnd) | ||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | aboutToAppear(): void { | 39 | aboutToAppear(): void { |
-
Please register or login to post a comment