diff --git a/src/picker/README.zh-CN.md b/src/picker/README.zh-CN.md index 1ea50d160..807ac797d 100644 --- a/src/picker/README.zh-CN.md +++ b/src/picker/README.zh-CN.md @@ -223,6 +223,8 @@ Picker 组件的事件会根据 columns 是单列或多列返回不同的参数 |------|------| | default | 自定义顶部栏内容 | | title | 自定义标题内容 | +| columns-top | 自定义选项上方内容 | +| columns-bottom | 自定义选项下方内容 | ### Column 数据结构 diff --git a/src/picker/index.js b/src/picker/index.js index e6eea91e8..54717e636 100644 --- a/src/picker/index.js +++ b/src/picker/index.js @@ -183,6 +183,7 @@ export default createComponent({
{this.toolbarPosition === 'top' ? Toolbar : h()} {this.loading ? : h()} + {this.slots('columns-top')}
{columns.map((item, index) => (
+ {this.slots('columns-bottom')} {this.toolbarPosition === 'bottom' ? Toolbar : h()}
); diff --git a/src/picker/test/__snapshots__/index.spec.js.snap b/src/picker/test/__snapshots__/index.spec.js.snap index 938fd8322..a1d427794 100644 --- a/src/picker/test/__snapshots__/index.spec.js.snap +++ b/src/picker/test/__snapshots__/index.spec.js.snap @@ -28,6 +28,17 @@ exports[`column watch default index 2`] = `
`; +exports[`columns-top、columns-bottom prop 1`] = ` +
+
+ Custom Columns Top
+
+
+
Custom Columns Bottom + +
+`; + exports[`not allow html 1`] = `
diff --git a/src/picker/test/index.spec.js b/src/picker/test/index.spec.js index fccdb2cd9..f64af7145 100644 --- a/src/picker/test/index.spec.js +++ b/src/picker/test/index.spec.js @@ -206,3 +206,17 @@ test('not allow html', () => { expect(wrapper).toMatchSnapshot(); }); + +test('columns-top、columns-bottom prop', () => { + const wrapper = mount(Picker, { + propsData: { + showToolbar: true + }, + scopedSlots: { + 'columns-top': () => 'Custom Columns Top', + 'columns-bottom': () => 'Custom Columns Bottom', + } + }); + + expect(wrapper).toMatchSnapshot(); +});