Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 日历设置为选择周时,报错:weekDate对象不可迭代 #2538

Merged
merged 2 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/packages/__VUE/calendar/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<nut-cell
:show-icon="true"
:title="translate('week')"
:desc="date9 ? `${date9[0]}${translate('conjunction')}${date9[1]}` : translate('please')"
:desc="date9.length ? `${date9[0]}${translate('conjunction')}${date9[1]}` : translate('please')"
@click="openSwitch('isVisible9')"
>
</nut-cell>
Expand Down Expand Up @@ -296,7 +296,7 @@ export default defineComponent({
date6: [] as string[],
date7: [] as string[],
date8: '',
date9: ['2020-01-23', '2020-01-26'],
date9: [] as string[],
isVisible1: false,
isVisible2: false,
isVisible3: false,
Expand Down
3 changes: 3 additions & 0 deletions src/packages/__VUE/calendaritem/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@
if ((type == 'range' && state.chooseData.length == 2) || type != 'range') {
let selectData: any = state.chooseData.slice(0);
if (type == 'week') {
if (state.chooseData.length !== 2) {
return;
}

Check warning on line 283 in src/packages/__VUE/calendaritem/index.vue

View check run for this annotation

Codecov / codecov/patch

src/packages/__VUE/calendaritem/index.vue#L281-L283

Added lines #L281 - L283 were not covered by tests
selectData = {
weekDate: [handleWeekDate(state.chooseData[0] as string[]), handleWeekDate(state.chooseData[1] as string[])]
};
Expand Down