feat(CellGroup): add title slot (#4227)

This commit is contained in:
neverland
2019-08-25 10:55:01 +08:00
committed by GitHub
parent 689a579503
commit dc6a3c4243
5 changed files with 42 additions and 9 deletions
+7
View File
@@ -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 |
+7
View File
@@ -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>
+11
View File
@@ -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();
});