mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-07-03 21:48:10 +08:00
Compare commits
4 Commits
2b3c1baa0b
...
f63ea390b6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f63ea390b6 | ||
|
|
0b12b45d69 | ||
|
|
bf84fb1003 | ||
|
|
b2bf45b0d1 |
@ -16,20 +16,63 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
|
||||
|
||||
## Details
|
||||
|
||||
### [v3.4.0](https://github.com/compare/v3.3.7...v3.4.0)
|
||||
|
||||
`2022-01-01`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Icons: complete https protocol [#10079](https://github.com/youzan/vant/issues/10079)
|
||||
- Picker: should not render mask and frame when options is empty [#10135](https://github.com/youzan/vant/issues/10135)
|
||||
- Popup: close event emitted twice [#10132](https://github.com/youzan/vant/issues/10132)
|
||||
- PullRefresh: may trigger browser bounce in some cases [#10080](https://github.com/youzan/vant/issues/10080)
|
||||
- Step: fix inactive title style [#10049](https://github.com/youzan/vant/issues/10049)
|
||||
- SwipeCell: should not trigger open event when opened [#10059](https://github.com/youzan/vant/issues/10059)
|
||||
- swipe: delay load cause swipe error [#10052](https://github.com/youzan/vant/issues/10052) [#10069](https://github.com/youzan/vant/issues/10069)
|
||||
- Tabs: should not render line when have no tab [#10063](https://github.com/youzan/vant/issues/10063)
|
||||
|
||||
**Feature**
|
||||
|
||||
- ActionBarIcon: add badge-props prop [#10096](https://github.com/youzan/vant/issues/10096)
|
||||
- ActionSheet: add option slot [#10065](https://github.com/youzan/vant/issues/10065)
|
||||
- Badge: add badge-props prop [#10095](https://github.com/youzan/vant/issues/10095)
|
||||
- GridItem: add badge-props prop [#10097](https://github.com/youzan/vant/issues/10097)
|
||||
- Icons: add cash-o icon [#10076](https://github.com/youzan/vant/issues/10076)
|
||||
- ImagePreview: add overlayClass option [#10044](https://github.com/youzan/vant/issues/10044)
|
||||
- Notify: add position prop [#10056](https://github.com/youzan/vant/issues/10056)
|
||||
- Popover: add action slot [#10091](https://github.com/youzan/vant/issues/10091)
|
||||
- Search: add click-left-icon、click-right-icon event [#10139](https://github.com/youzan/vant/issues/10139)
|
||||
- SidebarItem: add badge-props prop [#10106](https://github.com/youzan/vant/issues/10106)
|
||||
- Swipe: indicator slot add total param [#10060](https://github.com/youzan/vant/issues/10060)
|
||||
- TabbarItem: add badge-props prop [#10092](https://github.com/youzan/vant/issues/10092)
|
||||
- Tabs: add shrink prop [#10125](https://github.com/youzan/vant/issues/10125)
|
||||
|
||||
**style**
|
||||
|
||||
- PullRefresh: remove user-select: none [#10078](https://github.com/youzan/vant/issues/10078)
|
||||
- TreeSelect: allow select text in content slot [#10081](https://github.com/youzan/vant/issues/10081)
|
||||
|
||||
**Types**
|
||||
|
||||
- define global components for volar [#10136](https://github.com/youzan/vant/issues/10136)
|
||||
- Field: type prop allow all native types [#10042](https://github.com/youzan/vant/issues/10042)
|
||||
- Popup: add PopupInstance type [#10062](https://github.com/youzan/vant/issues/10062)
|
||||
- Search: fix missing event typing [#10134](https://github.com/youzan/vant/issues/10134)
|
||||
|
||||
### [v3.3.7](https://github.com/compare/v3.3.6...v3.3.7)
|
||||
|
||||
`2021-12-12`
|
||||
|
||||
**Feature**
|
||||
|
||||
- Badge: add position prop [#10024](https://github.com/issues/10024)
|
||||
- Badge: add position prop [#10024](https://github.com/youzan/vant/issues/10024)
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- DatetimePicker: should update value after calling picker methods [#10029](https://github.com/issues/10029)
|
||||
- Field: fix the length of emoji [#10033](https://github.com/issues/10033)
|
||||
- Pagination: change event not work [#10018](https://github.com/issues/10018)
|
||||
- fix tree shaking is broken [#10034](https://github.com/issues/10034)
|
||||
- DatetimePicker: should update value after calling picker methods [#10029](https://github.com/youzan/vant/issues/10029)
|
||||
- Field: fix the length of emoji [#10033](https://github.com/youzan/vant/issues/10033)
|
||||
- Pagination: change event not work [#10018](https://github.com/youzan/vant/issues/10018)
|
||||
- fix tree shaking is broken [#10034](https://github.com/youzan/vant/issues/10034)
|
||||
|
||||
### [v3.3.6](https://github.com/compare/v3.3.5...v3.3.6)
|
||||
|
||||
|
||||
@ -16,20 +16,63 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
|
||||
|
||||
## 更新内容
|
||||
|
||||
### [v3.4.0](https://github.com/compare/v3.3.7...v3.4.0)
|
||||
|
||||
`2022-01-01`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Icons: 修复 URL 缺少协议导致个别浏览器出现异常的问题 [#10079](https://github.com/youzan/vant/issues/10079)
|
||||
- Picker: 修复选项为空时也会渲染选择框的问题 [#10135](https://github.com/youzan/vant/issues/10135)
|
||||
- Popup: 修复 close 事件触发两次的问题 [#10132](https://github.com/youzan/vant/issues/10132)
|
||||
- PullRefresh: 修复在个别浏览器上会触发原生回弹效果的问题 [#10080](https://github.com/youzan/vant/issues/10080)
|
||||
- Step: 修复 inactive-color 属性未正确生效的问题 [#10049](https://github.com/youzan/vant/issues/10049)
|
||||
- SwipeCell: 修复打开状态下也会触发 open 事件的问题 [#10059](https://github.com/youzan/vant/issues/10059)
|
||||
- swipe: 修复个别情况下无法正确滚动的问题 [#10052](https://github.com/youzan/vant/issues/10052) [#10069](https://github.com/youzan/vant/issues/10069)
|
||||
- Tabs: 修复标签页为空时会渲染一个错误的底部条的问题 [#10063](https://github.com/youzan/vant/issues/10063)
|
||||
|
||||
**Feature**
|
||||
|
||||
- ActionBarIcon: 新增 badge-props 属性 [#10096](https://github.com/youzan/vant/issues/10096)
|
||||
- ActionSheet: 新增 option 插槽 [#10065](https://github.com/youzan/vant/issues/10065)
|
||||
- Badge: 新增 badge-props 属性 [#10095](https://github.com/youzan/vant/issues/10095)
|
||||
- GridItem: 新增 badge-props 属性 [#10097](https://github.com/youzan/vant/issues/10097)
|
||||
- Icons: 新增 cash-o 图标 [#10076](https://github.com/youzan/vant/issues/10076)
|
||||
- ImagePreview: 新增 overlayClass 选项 [#10044](https://github.com/youzan/vant/issues/10044)
|
||||
- Notify: 新增 position 属性 [#10056](https://github.com/youzan/vant/issues/10056)
|
||||
- Popover: 新增 action 插槽 [#10091](https://github.com/youzan/vant/issues/10091)
|
||||
- Search: 新增 click-left-icon、click-right-icon 事件 [#10139](https://github.com/youzan/vant/issues/10139)
|
||||
- SidebarItem: 新增 badge-props 属性 [#10106](https://github.com/youzan/vant/issues/10106)
|
||||
- Swipe: indicator 插槽新增 total 参数 [#10060](https://github.com/youzan/vant/issues/10060)
|
||||
- TabbarItem: 新增 badge-props 属性 [#10092](https://github.com/youzan/vant/issues/10092)
|
||||
- Tabs: 新增 shrink 属性 [#10125](https://github.com/youzan/vant/issues/10125)
|
||||
|
||||
**style**
|
||||
|
||||
- PullRefresh: 移除 `user-select: none` 样式 [#10078](https://github.com/youzan/vant/issues/10078)
|
||||
- TreeSelect: 允许选中 content 插槽中的文字 [#10081](https://github.com/youzan/vant/issues/10081)
|
||||
|
||||
**Types**
|
||||
|
||||
- 增加所有组件的全局类型,在 volar 中提供默认提示 [#10136](https://github.com/youzan/vant/issues/10136)
|
||||
- Field: 修复 type 属性定义不全的问题 [#10042](https://github.com/youzan/vant/issues/10042)
|
||||
- Popup: 导出 PopupInstance 类型 [#10062](https://github.com/youzan/vant/issues/10062)
|
||||
- Search: 修复事件类型定义不全的问题 [#10134](https://github.com/youzan/vant/issues/10134)
|
||||
|
||||
### [v3.3.7](https://github.com/compare/v3.3.6...v3.3.7)
|
||||
|
||||
`2021-12-12`
|
||||
|
||||
**Feature**
|
||||
|
||||
- Badge: 新增 position 属性 [#10024](https://github.com/issues/10024)
|
||||
- Badge: 新增 position 属性 [#10024](https://github.com/youzan/vant/issues/10024)
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- DatetimePicker: 修复调用 Picker 实例方法后日期未正确更新的问题 [#10029](https://github.com/issues/10029)
|
||||
- Field: 修复输入内容包含 emoji 时,长度计算错误的问题 [#10033](https://github.com/issues/10033)
|
||||
- Pagination: 修复 change 事件不触发的问题 [#10018](https://github.com/issues/10018)
|
||||
- 修复 tree shaking 不生效的问题 [#10034](https://github.com/issues/10034)
|
||||
- DatetimePicker: 修复调用 Picker 实例方法后日期未正确更新的问题 [#10029](https://github.com/youzan/vant/issues/10029)
|
||||
- Field: 修复输入内容包含 emoji 时,长度计算错误的问题 [#10033](https://github.com/youzan/vant/issues/10033)
|
||||
- Pagination: 修复 change 事件不触发的问题 [#10018](https://github.com/youzan/vant/issues/10018)
|
||||
- 修复 tree shaking 不生效的问题 [#10034](https://github.com/youzan/vant/issues/10034)
|
||||
|
||||
### [v3.3.6](https://github.com/compare/v3.3.5...v3.3.6)
|
||||
|
||||
@ -74,15 +117,15 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
|
||||
|
||||
**Feature**
|
||||
|
||||
- 新增 `package.json` 中的 `exports` 字段 [#9952](https://github.com/issues/9952)
|
||||
- Tabbar: 支持在 route 模式下匹配子路由 [#9926](https://github.com/issues/9926)
|
||||
- Tabs: 将 `van-tab__pane-wrapper` 类重命名为 `van-tab__panel-wrapper` [#9951](https://github.com/issues/9951)
|
||||
- 新增 `package.json` 中的 `exports` 字段 [#9952](https://github.com/youzan/vant/issues/9952)
|
||||
- Tabbar: 支持在 route 模式下匹配子路由 [#9926](https://github.com/youzan/vant/issues/9926)
|
||||
- Tabs: 将 `van-tab__pane-wrapper` 类重命名为 `van-tab__panel-wrapper` [#9951](https://github.com/youzan/vant/issues/9951)
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Calendar: 修复 show-confirm 为 false 时不会限制最大日期范围的问题 [#9948](https://github.com/issues/9948)
|
||||
- Calendar: 修复 `scrollToDate` 方法无法精确滚动到对应日期的问题 [#9949](https://github.com/issues/9949)
|
||||
- Swipe: 修复开始滑动时未阻止 touchmove 事件行为的问题 [#9920](https://github.com/issues/9920)
|
||||
- Calendar: 修复 show-confirm 为 false 时不会限制最大日期范围的问题 [#9948](https://github.com/youzan/vant/issues/9948)
|
||||
- Calendar: 修复 `scrollToDate` 方法无法精确滚动到对应日期的问题 [#9949](https://github.com/youzan/vant/issues/9949)
|
||||
- Swipe: 修复开始滑动时未阻止 touchmove 事件行为的问题 [#9920](https://github.com/youzan/vant/issues/9920)
|
||||
|
||||
### [v3.3.1](https://github.com/compare/v3.3.0...v3.3.1)
|
||||
|
||||
@ -90,7 +133,7 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- AddressEdit: 修复表单校验不通过时也会触发 save 事件的问题 [#9917](https://github.com/issues/9917)
|
||||
- AddressEdit: 修复表单校验不通过时也会触发 save 事件的问题 [#9917](https://github.com/youzan/vant/issues/9917)
|
||||
|
||||
### [v3.3.0](https://github.com/compare/v3.2.8...v3.3.0)
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vant",
|
||||
"version": "3.3.7",
|
||||
"version": "3.4.0",
|
||||
"description": "Mobile UI Components built on Vue",
|
||||
"main": "lib/vant.cjs.js",
|
||||
"module": "es/index.js",
|
||||
|
||||
@ -223,7 +223,7 @@ export default {
|
||||
| default | Custom content |
|
||||
| description | Custom description above the options |
|
||||
| cancel `v3.0.10` | Custom the content of cancel button |
|
||||
| action `v3.3.8` | Custom the content of action | _{ action: ActionSheetAction, index: number }_ |
|
||||
| action `v3.4.0` | Custom the content of action | _{ action: ActionSheetAction, index: number }_ |
|
||||
|
||||
### Types
|
||||
|
||||
|
||||
@ -235,7 +235,7 @@ export default {
|
||||
| default | 自定义面板的展示内容 | - |
|
||||
| description | 自定义描述文案 | - |
|
||||
| cancel `v3.0.10` | 自定义取消按钮内容 | - |
|
||||
| action `v3.3.8` | 自定义选项内容 | _{ action: ActionSheetAction, index: number }_ |
|
||||
| action `v3.4.0` | 自定义选项内容 | _{ action: ActionSheetAction, index: number }_ |
|
||||
|
||||
### 类型定义
|
||||
|
||||
|
||||
@ -18,9 +18,13 @@ export const pickerInheritKeys = Object.keys(pickerSharedProps) as Array<
|
||||
>;
|
||||
|
||||
export function times<T>(n: number, iteratee: (index: number) => T) {
|
||||
let index = -1;
|
||||
if (n < 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const result: T[] = Array(n);
|
||||
|
||||
let index = -1;
|
||||
while (++index < n) {
|
||||
result[index] = iteratee(index);
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ export default {
|
||||
| type | Can be set to `primary` `success` `warning` | _NotifyType_ | `danger` |
|
||||
| message | Message | _string_ | - |
|
||||
| duration | Duration(ms), won't disappear if value is 0 | _number \| string_ | `3000` |
|
||||
| position `v3.3.8` | Position, can be set to `bottom` | _NotifyPosition_ | `top` |
|
||||
| position `v3.4.0` | Position, can be set to `bottom` | _NotifyPosition_ | `top` |
|
||||
| color | Message color | _string_ | `white` |
|
||||
| background | Background color | _string_ | - |
|
||||
| className | Custom className | _string \| Array \| object_ | - |
|
||||
|
||||
@ -163,7 +163,7 @@ export default {
|
||||
| type | 类型,可选值为 `primary` `success` `warning` | _NotifyType_ | `danger` |
|
||||
| message | 展示文案,支持通过`\n`换行 | _string_ | - |
|
||||
| duration | 展示时长(ms),值为 0 时,notify 不会消失 | _number \| string_ | `3000` |
|
||||
| position `v3.3.8` | 弹出位置,可选值为 `bottom` | _NotifyPosition_ | `top` |
|
||||
| position `v3.4.0` | 弹出位置,可选值为 `bottom` | _NotifyPosition_ | `top` |
|
||||
| color | 字体颜色 | _string_ | `white` |
|
||||
| background | 背景颜色 | _string_ | - |
|
||||
| className | 自定义类名 | _string \| Array \| object_ | - |
|
||||
|
||||
@ -254,7 +254,7 @@ export default {
|
||||
| --- | --- | --- |
|
||||
| default | Custom content | - |
|
||||
| reference | Reference Element | - |
|
||||
| action `v3.3.8` | Custom the content of option | _{ action: PopoverAction, index: number }_ |
|
||||
| action `v3.4.0` | Custom the content of option | _{ action: PopoverAction, index: number }_ |
|
||||
|
||||
### Types
|
||||
|
||||
|
||||
@ -266,7 +266,7 @@ export default {
|
||||
| --- | --- | --- |
|
||||
| default | 自定义菜单内容 | - |
|
||||
| reference | 触发 Popover 显示的元素内容 | - |
|
||||
| action `v3.3.8` | 自定义选项内容 | _{ action: PopoverAction, index: number }_ |
|
||||
| action `v3.4.0` | 自定义选项内容 | _{ action: PopoverAction, index: number }_ |
|
||||
|
||||
### 类型定义
|
||||
|
||||
|
||||
@ -170,6 +170,8 @@ export default {
|
||||
| focus | Emitted when input is focused | _event: Event_ |
|
||||
| blur | Emitted when input is blurred | _event: Event_ |
|
||||
| click-input | Emitted when the input is clicked | _event: MouseEvent_ |
|
||||
| click-left-icon `v3.4.0` | Emitted when the left icon is clicked | _event: MouseEvent_ |
|
||||
| click-right-icon `v3.4.0` | Emitted when the right icon is clicked | _event: MouseEvent_ |
|
||||
| clear | Emitted when the clear icon is clicked | _event: MouseEvent_ |
|
||||
| cancel | Emitted when the cancel button is clicked | - |
|
||||
|
||||
|
||||
@ -175,15 +175,17 @@ export default {
|
||||
|
||||
### Events
|
||||
|
||||
| 事件名 | 说明 | 回调参数 |
|
||||
| ------------------ | -------------------- | ------------------------------ |
|
||||
| search | 确定搜索时触发 | _value: string (当前输入的值)_ |
|
||||
| 事件名 | 说明 | 回调参数 |
|
||||
| --- | --- | --- |
|
||||
| search | 确定搜索时触发 | _value: string (当前输入的值)_ |
|
||||
| update:model-value | 输入框内容变化时触发 | _value: string (当前输入的值)_ |
|
||||
| focus | 输入框获得焦点时触发 | _event: Event_ |
|
||||
| blur | 输入框失去焦点时触发 | _event: Event_ |
|
||||
| click-input | 点击输入区域时触发 | _event: MouseEvent_ |
|
||||
| clear | 点击清除按钮后触发 | _event: MouseEvent_ |
|
||||
| cancel | 点击取消按钮时触发 | - |
|
||||
| focus | 输入框获得焦点时触发 | _event: Event_ |
|
||||
| blur | 输入框失去焦点时触发 | _event: Event_ |
|
||||
| click-input | 点击输入区域时触发 | _event: MouseEvent_ |
|
||||
| click-left-icon `v3.4.0` | 点击左侧图标时触发 | _event: MouseEvent_ |
|
||||
| click-right-icon `3.4.0` | 点击右侧图标时触发 | _event: MouseEvent_ |
|
||||
| clear | 点击清除按钮后触发 | _event: MouseEvent_ |
|
||||
| cancel | 点击取消按钮时触发 | - |
|
||||
|
||||
### 方法
|
||||
|
||||
|
||||
@ -47,6 +47,8 @@ export default defineComponent({
|
||||
'search',
|
||||
'cancel',
|
||||
'click-input',
|
||||
'click-left-icon',
|
||||
'click-right-icon',
|
||||
'update:modelValue',
|
||||
],
|
||||
|
||||
@ -103,6 +105,10 @@ export default defineComponent({
|
||||
const onFocus = (event: Event) => emit('focus', event);
|
||||
const onClear = (event: MouseEvent) => emit('clear', event);
|
||||
const onClickInput = (event: MouseEvent) => emit('click-input', event);
|
||||
const onClickLeftIcon = (event: MouseEvent) =>
|
||||
emit('click-left-icon', event);
|
||||
const onClickRightIcon = (event: MouseEvent) =>
|
||||
emit('click-right-icon', event);
|
||||
|
||||
const fieldPropNames = Object.keys(fieldSharedProps) as Array<
|
||||
keyof typeof fieldSharedProps
|
||||
@ -127,6 +133,8 @@ export default defineComponent({
|
||||
onClear={onClear}
|
||||
onKeypress={onKeypress}
|
||||
onClick-input={onClickInput}
|
||||
onClick-left-icon={onClickLeftIcon}
|
||||
onClick-right-icon={onClickRightIcon}
|
||||
onUpdate:modelValue={onInput}
|
||||
{...fieldAttrs}
|
||||
/>
|
||||
|
||||
@ -170,3 +170,25 @@ test('should render input name when using name prop', () => {
|
||||
});
|
||||
expect(wrapper.find('input').element.getAttribute('name')).toEqual('foo');
|
||||
});
|
||||
|
||||
test('should emit click-left-icon event after clicking the left icon', async () => {
|
||||
const wrapper = mount(Search, {
|
||||
props: {
|
||||
leftIcon: 'foo',
|
||||
},
|
||||
});
|
||||
|
||||
await wrapper.find('.van-field__left-icon').trigger('click');
|
||||
expect(wrapper.emitted('click-left-icon')).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('should emit click-right-icon event after clicking the right icon', async () => {
|
||||
const wrapper = mount(Search, {
|
||||
props: {
|
||||
rightIcon: 'foo',
|
||||
},
|
||||
});
|
||||
|
||||
await wrapper.find('.van-field__right-icon').trigger('click');
|
||||
expect(wrapper.emitted('click-right-icon')).toHaveLength(1);
|
||||
});
|
||||
|
||||
@ -209,7 +209,7 @@ swipeRef.value?.next();
|
||||
| Name | Description | SlotProps |
|
||||
| ------------------ | ---------------- | ----------------------------------- |
|
||||
| default | Content | - |
|
||||
| indicator `v3.3.8` | Custom indicator | _{ active: number, total: number }_ |
|
||||
| indicator `v3.4.0` | Custom indicator | _{ active: number, total: number }_ |
|
||||
|
||||
## Theming
|
||||
|
||||
|
||||
@ -217,7 +217,7 @@ swipeRef.value?.next();
|
||||
| 名称 | 说明 | 参数 |
|
||||
| ------------------ | ------------ | ----------------------------------- |
|
||||
| default | 轮播内容 | - |
|
||||
| indicator `v3.3.8` | 自定义指示器 | _{ active: number, total: number }_ |
|
||||
| indicator `v3.4.0` | 自定义指示器 | _{ active: number, total: number }_ |
|
||||
|
||||
## 主题定制
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user