feat(CellGroup): add title slot (#4227)
This commit is contained in:
@@ -132,6 +132,13 @@ Vue.use(Cell).use(CellGroup);
|
||||
|------|------|------|
|
||||
| click | Triggered when click cell | event: Event |
|
||||
|
||||
### CellGroup Slots
|
||||
|
||||
| Name | Description |
|
||||
|------|------|
|
||||
| default | Default slot |
|
||||
| title | Custom title |
|
||||
|
||||
### Cell Slots
|
||||
|
||||
| Name | Description |
|
||||
|
||||
@@ -147,3 +147,10 @@ Vue.use(Cell).use(CellGroup);
|
||||
| label | 自定义标题下方描述显示内容 |
|
||||
| icon | 自定义左侧图标 |
|
||||
| right-icon | 自定义右侧按钮,默认为`arrow` |
|
||||
|
||||
### CellGroup Slots
|
||||
|
||||
| 名称 | 说明 |
|
||||
|------|------|
|
||||
| default | 默认插槽 |
|
||||
| title | 自定义分组标题 |
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`CellGroup title slot 1`] = `
|
||||
<div>
|
||||
<div class="van-cell-group__title">CustomTitle</div>
|
||||
<div class="van-cell-group van-hairline--top-bottom"></div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`arrow direction 1`] = `
|
||||
<div class="van-cell van-cell--clickable"><i class="van-icon van-icon-arrow-down van-cell__right-icon">
|
||||
<!----></i></div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Cell from '..';
|
||||
import CellGroup from '../../cell-group';
|
||||
import { mount } from '../../../test/utils';
|
||||
|
||||
test('click event', () => {
|
||||
@@ -56,3 +57,13 @@ test('title-style prop', () => {
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('CellGroup title slot', () => {
|
||||
const wrapper = mount(CellGroup, {
|
||||
scopedSlots: {
|
||||
title: () => 'CustomTitle'
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user