From 68c212df65d47a9d43d38b72d90a249adbf4a25e Mon Sep 17 00:00:00 2001 From: SnowWinterMaye Date: Tue, 16 Jul 2019 21:19:47 +0800 Subject: [PATCH] =?UTF-8?q?datePicker=20=20=E6=B7=BB=E5=8A=A0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=B8=B2=E6=9F=93slot=E6=94=AF=E6=8C=81=20(#957)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * datePicker 添加默认渲染slot支持 * 功能优化 --- components/date-picker/RangePicker.jsx | 3 +- .../__tests__/__snapshots__/demo.test.js.snap | 6 ++ components/date-picker/createPicker.js | 3 +- components/date-picker/demo/index.vue | 2 + components/date-picker/demo/text.md | 55 +++++++++++++++++++ 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 components/date-picker/demo/text.md diff --git a/components/date-picker/RangePicker.jsx b/components/date-picker/RangePicker.jsx index f9665d00f..c2915141c 100644 --- a/components/date-picker/RangePicker.jsx +++ b/components/date-picker/RangePicker.jsx @@ -409,6 +409,7 @@ export default { openChange: this.handleOpenChange, }, style: popupStyle, + scopedSlots: { default: input, ...$scopedSlots }, }, ); return ( @@ -422,7 +423,7 @@ export default { onMouseenter={this.onMouseEnter} onMouseleave={this.onMouseLeave} > - {input} + ); }, diff --git a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap index 95e81b216..d4dcfd5d3 100644 --- a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap +++ b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap @@ -70,6 +70,12 @@ exports[`renders ./components/date-picker/demo/suffix.md correctly 1`] = `

ab

ab

~ ab
ab `; +exports[`renders ./components/date-picker/demo/text.md correctly 1`] = ` +
SelectTime
+ 请选择 +
+`; + exports[`renders ./components/date-picker/demo/time.md correctly 1`] = `

~ - {input} + ); }, diff --git a/components/date-picker/demo/index.vue b/components/date-picker/demo/index.vue index 7d402765a..f0c823c30 100644 --- a/components/date-picker/demo/index.vue +++ b/components/date-picker/demo/index.vue @@ -11,6 +11,7 @@ import Size from './size'; import StartEnd from './start-end'; import Time from './time'; import Suffix from './suffix'; +import Text from './text'; import CN from '../index.zh-CN.md'; import US from '../index.en-US.md'; const md = { @@ -47,6 +48,7 @@ export default {