File tree Expand file tree Collapse file tree 3 files changed +73
-1
lines changed Expand file tree Collapse file tree 3 files changed +73
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export default defineComponent({
1616 format : 'HH:mm:ss' ,
1717 } ) ,
1818 emits : [ 'finish' , 'change' ] ,
19- setup ( props , { emit } ) {
19+ setup ( props , { emit, slots } ) {
2020 const countdownId = ref < any > ( ) ;
2121 const statistic = ref ( ) ;
2222 const syncTimer = ( ) => {
@@ -84,6 +84,7 @@ export default defineComponent({
8484 valueRender : valueRenderHtml ,
8585 formatter : formatCountdown ,
8686 } }
87+ v-slots = { slots }
8788 />
8889 ) ;
8990 } ;
Original file line number Diff line number Diff line change 1+ <docs >
2+ ---
3+ order: 4
4+ title:
5+ zh-CN: 倒计时组件
6+ en-US: Countdown
7+ ---
8+
9+ ## zh-CN
10+
11+ 倒计时组件使用插槽。
12+
13+ ## en-US
14+
15+ Countdown component slots.
16+
17+ </docs >
18+
19+ <template >
20+ <a-row :gutter =" 16" >
21+ <a-col :span =" 12" >
22+ <a-statistic-countdown :value =" deadline" style =" margin-right : 50px " @finish =" onFinish" >
23+ <template #title >
24+ <span >Countdown</span >
25+ <a-tooltip placement =" right" >
26+ <template #title >
27+ <span >hurry up!</span >
28+ </template >
29+ <question-circle-two-tone style =" margin-left : 5px " />
30+ </a-tooltip >
31+ </template >
32+ </a-statistic-countdown >
33+ </a-col >
34+ <a-col :span =" 24" style =" margin-top : 32px " >
35+ <a-statistic-countdown
36+ title =" Million Seconds countdown"
37+ :value =" deadline"
38+ format =" HH:mm:ss:SSS"
39+ style =" margin-right : 50px "
40+ >
41+ <template #prefix >
42+ <span >There's only</span >
43+ </template >
44+ <template #suffix >
45+ <span >left for the end.</span >
46+ </template >
47+ </a-statistic-countdown >
48+ </a-col >
49+ </a-row >
50+ </template >
51+ <script lang="ts">
52+ import { QuestionCircleTwoTone } from ' @ant-design/icons-vue' ;
53+ import { defineComponent } from ' vue' ;
54+ export default defineComponent ({
55+ components: {
56+ QuestionCircleTwoTone ,
57+ },
58+ setup() {
59+ const onFinish = () => {
60+ console .log (' finished!' );
61+ };
62+ return {
63+ deadline: Date .now () + 1000 * 60 * 60 * 20 * 2 ,
64+ onFinish ,
65+ };
66+ },
67+ });
68+ </script >
Original file line number Diff line number Diff line change 44 <unit />
55 <card />
66 <countdown />
7+ <countdown-slot />
78 </demo-sort >
89</template >
910<script lang="ts">
1011import Basic from ' ./basic.vue' ;
1112import Unit from ' ./unit.vue' ;
1213import Card from ' ./card.vue' ;
1314import Countdown from ' ./countdown.vue' ;
15+ import CountdownSlot from ' ./countdown-slot.vue' ;
1416import CN from ' ../index.zh-CN.md' ;
1517import US from ' ../index.en-US.md' ;
1618import { defineComponent } from ' vue' ;
@@ -22,6 +24,7 @@ export default defineComponent({
2224 Unit ,
2325 Card ,
2426 Countdown ,
27+ CountdownSlot ,
2528 },
2629 setup() {
2730 return {};
You can’t perform that action at this time.
0 commit comments