From d2d2ca3b84217217b1d28fb1865c31de05735814 Mon Sep 17 00:00:00 2001 From: ltinerary <948615201@qq.com> Date: Tue, 7 Dec 2021 21:11:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=8E=88=20fix=20countdown=20slot=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/statistic/Countdown.tsx | 10 ++- components/statistic/demo/countdown-slot.vue | 68 ++++++++++++++++++++ components/statistic/demo/index.vue | 3 + 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 components/statistic/demo/countdown-slot.vue diff --git a/components/statistic/Countdown.tsx b/components/statistic/Countdown.tsx index 3fb37620fc..a2ccb8c167 100644 --- a/components/statistic/Countdown.tsx +++ b/components/statistic/Countdown.tsx @@ -16,7 +16,7 @@ export default defineComponent({ format: 'HH:mm:ss', }), emits: ['finish', 'change'], - setup(props, { emit }) { + setup(props, { emit, slots }) { const countdownId = ref(); const statistic = ref(); const syncTimer = () => { @@ -76,6 +76,9 @@ export default defineComponent({ stopTimer(); }); return () => { + const title = props.title ?? slots.title?.(); + const prefix = props.prefix ?? slots.prefix?.(); + const suffix = props.suffix ?? slots.suffix?.(); return ( ); }; diff --git a/components/statistic/demo/countdown-slot.vue b/components/statistic/demo/countdown-slot.vue new file mode 100644 index 0000000000..fec5ca052a --- /dev/null +++ b/components/statistic/demo/countdown-slot.vue @@ -0,0 +1,68 @@ + +--- +order: 4 +title: + zh-CN: 倒计时组件 + en-US: Countdown +--- + +## zh-CN + +倒计时组件使用插槽。 + +## en-US + +Countdown component slots. + + + + + diff --git a/components/statistic/demo/index.vue b/components/statistic/demo/index.vue index e79ab9d6af..a395ac713e 100644 --- a/components/statistic/demo/index.vue +++ b/components/statistic/demo/index.vue @@ -4,6 +4,7 @@ +