Compare commits

..

No commits in common. "62a30bbf02d432fc337b1120998028a92371555d" and "5c99ded59dcfad0776aec4943b3819ff32470501" have entirely different histories.

6 changed files with 9 additions and 86 deletions

View File

@ -71,25 +71,19 @@ Vant 2 supports modern browsers and Android >= 4.0、iOS >= 8.0.
Vant 3 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3).
## Official Ecosystem
## Ecosystem
| Project | Description |
| --- | --- |
| [vant-weapp](https://github.com/youzan/vant-weapp) | WeChat MiniProgram UI |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI (maintained by the community) |
| [vant-react](https://github.com/mxdi9i7/vant-react) | Vant React (maintained by the community) |
| [vant-use](https://youzan.github.io/vant/vant-use/) | Collection of Vant Composition APIs |
| [vant-demo](https://github.com/youzan/vant-demo) | Collection of Vant demos |
| [vant-cli](https://github.com/youzan/vant/tree/dev/packages/vant-cli) | Scaffold for UI library |
| [vant-icons](https://github.com/youzan/vant/tree/dev/packages/vant-icons) | Vant icons |
| [vant-touch-emulator](https://github.com/youzan/vant/tree/dev/packages/vant-touch-emulator) | Using vant in desktop browsers |
## Community Ecosystem
| Project | Description |
| --- | --- |
| [vant-react](https://github.com/mxdi9i7/vant-react) | Vant React |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI |
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro |
## Links
- [Documentation](https://youzan.github.io/vant)

View File

@ -33,25 +33,19 @@ Vant 2 supports modern browsers and Android >= 4.0、iOS >= 8.0.
Vant 3 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3).
### Official Ecosystem
### Ecosystem
| Project | Description |
| --- | --- |
| [vant-weapp](https://github.com/youzan/vant-weapp) | WeChat MiniProgram UI |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI (maintained by the community) |
| [vant-react](https://github.com/mxdi9i7/vant-react) | Vant React (maintained by the community) |
| [vant-use](https://youzan.github.io/vant/vant-use/) | Collection of Vant Composition APIs |
| [vant-demo](https://github.com/youzan/vant-demo) | Collection of Vant demos |
| [vant-cli](https://github.com/youzan/vant/tree/dev/packages/vant-cli) | Scaffold for UI library |
| [vant-icons](https://github.com/youzan/vant/tree/dev/packages/vant-icons) | Vant icons |
| [vant-touch-emulator](https://github.com/youzan/vant/tree/dev/packages/vant-touch-emulator) | Using vant in desktop browsers |
### Community Ecosystem
| Project | Description |
| --- | --- |
| [vant-react](https://github.com/mxdi9i7/vant-react) | Vant React |
| [vant-aliapp](https://github.com/ant-move/Vant-Aliapp) | Alipay MiniProgram UI |
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro |
### Links
- [Feedback](https://github.com/youzan/vant/issues)

View File

@ -104,20 +104,9 @@ export default defineComponent({
default: 0,
validator: (val: number) => val >= 0 && val <= 6,
},
showRangePrompt: {
type: Boolean,
default: true,
},
},
emits: [
'select',
'confirm',
'unselect',
'month-show',
'update:show',
'over-range',
],
emits: ['select', 'confirm', 'unselect', 'month-show', 'update:show'],
setup(props, { emit, slots }) {
const limitDateRange = (
@ -319,13 +308,10 @@ export default defineComponent({
};
const checkRange = (date: [Date, Date]) => {
const { maxRange, rangePrompt, showRangePrompt } = props;
const { maxRange, rangePrompt } = props;
if (maxRange && calcDateNum(date) > maxRange) {
if (showRangePrompt) {
Toast(rangePrompt || t('rangePrompt', maxRange));
}
emit('over-range');
Toast(rangePrompt || t('rangePrompt', maxRange));
return false;
}

View File

@ -290,7 +290,6 @@ Following props are supported when the type is range
| --- | --- | --- | --- |
| max-range | Number of selectable days | _number \| string_ | Unlimited |
| range-prompt | Error message when exceeded max range | _string_ | `Choose no more than xx days` |
| show-range-prompt | Whether prompt error message when exceeded max range | _boolean_ | `true` |
| allow-same-day | Whether the start and end time of the range is allowed on the same day | _boolean_ | `false` |
### Calendar Multiple Props
@ -325,7 +324,6 @@ Following props are supported when the type is multiple
| closed | Emitted when Popup is closed | - |
| unselect | Emitted when unselect date when type is multiple | _value: Date_ |
| month-show | Emitted when a month enters the visible area | _{ date: Date, title: string }_ |
| over-range | Emitted when exceeded max range | - |
### Slots

View File

@ -294,7 +294,6 @@ export default {
| --- | --- | --- | --- |
| max-range | 日期区间最多可选天数 | _number \| string_ | 无限制 |
| range-prompt | 范围选择超过最多可选天数时的提示文案 | _string_ | `选择天数不能超过 xx 天` |
| show-range-prompt | 范围选择超过最多可选天数时,是否展示提示文案 | _boolean_ | `true` |
| allow-same-day | 是否允许日期范围的起止时间为同一天 | _boolean_ | `false` |
### Calendar Multiple Props
@ -331,7 +330,6 @@ export default {
| closed | 关闭弹出层且动画结束后触发 | - |
| unselect | 当日历组件的 `type``multiple` 时,取消选中日期时触发 | _value: Date_ |
| month-show | 当某个月份进入可视区域时触发 | _{ date: Date, title: string }_ |
| over-range | 范围选择超过最多可选天数时触发 | - |
### Slots

View File

@ -252,50 +252,3 @@ test('readonly prop', async () => {
days[13].trigger('click');
expect(wrapper.emitted('select')).toBeTruthy();
});
test('should disabled prompt when using show-range-prompt prop', async () => {
document.getElementsByTagName('html')[0].innerHTML = '';
const wrapper = mount(Calendar, {
props: {
type: 'range',
minDate,
maxDate,
maxRange: 3,
poppable: false,
lazyRender: false,
showRangePrompt: false,
},
});
await later();
const days = wrapper.findAll('.van-calendar__day');
days[12].trigger('click');
days[18].trigger('click');
await later();
expect(document.querySelector('.van-toast')).toBeFalsy();
});
test('should emit over-range when exceeded max range', async () => {
const onOverRange = jest.fn();
const wrapper = mount(Calendar, {
props: {
type: 'range',
minDate,
maxDate,
maxRange: 3,
onOverRange,
poppable: false,
lazyRender: false,
},
});
await later();
const days = wrapper.findAll('.van-calendar__day');
days[12].trigger('click');
days[18].trigger('click');
expect(onOverRange).toHaveBeenCalledTimes(1);
});