mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
Compare commits
4 Commits
f57e1313e9
...
ed3dbd969d
Author | SHA1 | Date | |
---|---|---|---|
|
ed3dbd969d | ||
|
e9c2549619 | ||
|
0dff20ee25 | ||
|
df7114701a |
@ -16,6 +16,20 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
|
|||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
|
### [v3.0.15](https://github.com/youzan/vant/compare/v2.12.14-test...v3.0.15)
|
||||||
|
|
||||||
|
`2021-04-25`
|
||||||
|
|
||||||
|
**Feature**
|
||||||
|
|
||||||
|
- Cascader: add click-tab event [#8606](https://github.com/youzan/vant/issues/8606)
|
||||||
|
|
||||||
|
**Bug Fixes**
|
||||||
|
|
||||||
|
- Tab: failed to render during SSR [#8603](https://github.com/youzan/vant/issues/8603)
|
||||||
|
- Rate: select half star correctly when clicked [#8580](https://github.com/youzan/vant/issues/8580)
|
||||||
|
- Tag: incorrect border color when using plain [#8601](https://github.com/youzan/vant/issues/8601)
|
||||||
|
|
||||||
### [v3.0.14](https://github.com/youzan/vant/compare/v3.0.13...v3.0.14)
|
### [v3.0.14](https://github.com/youzan/vant/compare/v3.0.13...v3.0.14)
|
||||||
|
|
||||||
`2021-04-18`
|
`2021-04-18`
|
||||||
|
@ -16,6 +16,20 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
|
|||||||
|
|
||||||
## 更新内容
|
## 更新内容
|
||||||
|
|
||||||
|
### [v3.0.15](https://github.com/youzan/vant/compare/v2.12.14-test...v3.0.15)
|
||||||
|
|
||||||
|
`2021-04-25`
|
||||||
|
|
||||||
|
**Feature**
|
||||||
|
|
||||||
|
- Cascader: 新增 click-tab 事件 [#8606](https://github.com/youzan/vant/issues/8606)
|
||||||
|
|
||||||
|
**Bug Fixes**
|
||||||
|
|
||||||
|
- Tab: 修复 SSR 时报错的问题 [#8603](https://github.com/youzan/vant/issues/8603)
|
||||||
|
- Rate: 修复点击半星时未正确选中的问题 [#8580](https://github.com/youzan/vant/issues/8580)
|
||||||
|
- Tag: 修复使用 color 和 plain 属性时边框颜色错误的问题 [#8601](https://github.com/youzan/vant/issues/8601)
|
||||||
|
|
||||||
### [v3.0.14](https://github.com/youzan/vant/compare/v3.0.13...v3.0.14)
|
### [v3.0.14](https://github.com/youzan/vant/compare/v3.0.13...v3.0.14)
|
||||||
|
|
||||||
`2021-04-18`
|
`2021-04-18`
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vant",
|
"name": "vant",
|
||||||
"version": "3.0.14",
|
"version": "3.0.15",
|
||||||
"description": "Mobile UI Components built on Vue",
|
"description": "Mobile UI Components built on Vue",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
|
@ -48,7 +48,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['close', 'change', 'finish', 'update:modelValue'],
|
emits: ['close', 'change', 'finish', 'update:modelValue', 'click-tab'],
|
||||||
|
|
||||||
setup(props, { slots, emit }) {
|
setup(props, { slots, emit }) {
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
@ -180,6 +180,10 @@ export default defineComponent({
|
|||||||
|
|
||||||
const onClose = () => emit('close');
|
const onClose = () => emit('close');
|
||||||
|
|
||||||
|
const onClickTab = (tabIndex: number, title: string) => {
|
||||||
|
emit('click-tab', tabIndex, title);
|
||||||
|
};
|
||||||
|
|
||||||
const renderHeader = () => (
|
const renderHeader = () => (
|
||||||
<div class={bem('header')}>
|
<div class={bem('header')}>
|
||||||
<h2 class={bem('title')}>
|
<h2 class={bem('title')}>
|
||||||
@ -247,6 +251,7 @@ export default defineComponent({
|
|||||||
color={props.activeColor}
|
color={props.activeColor}
|
||||||
swipeThreshold={0}
|
swipeThreshold={0}
|
||||||
swipeable={props.swipeable}
|
swipeable={props.swipeable}
|
||||||
|
onClick={onClickTab}
|
||||||
>
|
>
|
||||||
{state.tabs.map(renderTab)}
|
{state.tabs.map(renderTab)}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
@ -220,6 +220,7 @@ export default {
|
|||||||
| change | Emitted when active option changed | `{ value, selectedOptions, tabIndex }` |
|
| change | Emitted when active option changed | `{ value, selectedOptions, tabIndex }` |
|
||||||
| finish | Emitted when all options is selected | `{ value, selectedOptions, tabIndex }` |
|
| finish | Emitted when all options is selected | `{ value, selectedOptions, tabIndex }` |
|
||||||
| close | Emmitted when the close icon is clicked | - |
|
| close | Emmitted when the close icon is clicked | - |
|
||||||
|
| click-tab | Emitted when a tab is clicked | _activeTab: number, title: string_ |
|
||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
|
@ -225,11 +225,12 @@ export default {
|
|||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
| 事件 | 说明 | 回调参数 |
|
| 事件 | 说明 | 回调参数 |
|
||||||
| ------ | ---------------------- | -------------------------------------- |
|
| --------- | ---------------------- | -------------------------------------- |
|
||||||
| change | 选中项变化时触发 | `{ value, selectedOptions, tabIndex }` |
|
| change | 选中项变化时触发 | `{ value, selectedOptions, tabIndex }` |
|
||||||
| finish | 全部选项选择完成后触发 | `{ value, selectedOptions, tabIndex }` |
|
| finish | 全部选项选择完成后触发 | `{ value, selectedOptions, tabIndex }` |
|
||||||
| close | 点击关闭图标时触发 | - |
|
| close | 点击关闭图标时触发 | - |
|
||||||
|
| click-tab | 点击标签时触发 | _tabIndex: number, title: string_ |
|
||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
|
@ -176,3 +176,31 @@ test('should allow to custom field names', async () => {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should emit click-tab event when a tab is clicked', async () => {
|
||||||
|
const wrapper = mount(Cascader, {
|
||||||
|
props: {
|
||||||
|
options,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await later();
|
||||||
|
wrapper.find('.van-cascader__option').trigger('click');
|
||||||
|
await later();
|
||||||
|
wrapper
|
||||||
|
.findAll('.van-cascader__options')[1]
|
||||||
|
.find('.van-cascader__option')
|
||||||
|
.trigger('click');
|
||||||
|
await later();
|
||||||
|
|
||||||
|
const tabs = wrapper.findAll('.van-tab');
|
||||||
|
|
||||||
|
tabs[0].trigger('click');
|
||||||
|
expect(wrapper.emitted('click-tab')![0]).toEqual([0, options[0].text]);
|
||||||
|
|
||||||
|
tabs[1].trigger('click');
|
||||||
|
expect(wrapper.emitted('click-tab')![1]).toEqual([
|
||||||
|
1,
|
||||||
|
options[0].children[0].text,
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
@ -11,11 +11,11 @@ export const dateColumns = {
|
|||||||
],
|
],
|
||||||
'en-US': [
|
'en-US': [
|
||||||
{
|
{
|
||||||
values: ['Monday', 'Tuesday', 'Wednesday', 'Thusday', 'Friday'],
|
values: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
|
||||||
defaultIndex: 2,
|
defaultIndex: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
values: ['Morging', 'Afternoon', 'Evening'],
|
values: ['Morning', 'Afternoon', 'Evening'],
|
||||||
defaultIndex: 1,
|
defaultIndex: 1,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -222,7 +222,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
class="van-picker-column__item"
|
class="van-picker-column__item"
|
||||||
>
|
>
|
||||||
<div class="van-ellipsis">
|
<div class="van-ellipsis">
|
||||||
Thusday
|
Thursday
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li role="button"
|
<li role="button"
|
||||||
@ -246,7 +246,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
class="van-picker-column__item"
|
class="van-picker-column__item"
|
||||||
>
|
>
|
||||||
<div class="van-ellipsis">
|
<div class="van-ellipsis">
|
||||||
Morging
|
Morning
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li role="button"
|
<li role="button"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user