File tree 3 files changed +73
-1
lines changed
3 files changed +73
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export default defineComponent({
16
16
format : 'HH:mm:ss' ,
17
17
} ) ,
18
18
emits : [ 'finish' , 'change' ] ,
19
- setup ( props , { emit } ) {
19
+ setup ( props , { emit, slots } ) {
20
20
const countdownId = ref < any > ( ) ;
21
21
const statistic = ref ( ) ;
22
22
const syncTimer = ( ) => {
@@ -84,6 +84,7 @@ export default defineComponent({
84
84
valueRender : valueRenderHtml ,
85
85
formatter : formatCountdown ,
86
86
} }
87
+ v-slots = { slots }
87
88
/>
88
89
) ;
89
90
} ;
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 4
4
<unit />
5
5
<card />
6
6
<countdown />
7
+ <countdown-slot />
7
8
</demo-sort >
8
9
</template >
9
10
<script lang="ts">
10
11
import Basic from ' ./basic.vue' ;
11
12
import Unit from ' ./unit.vue' ;
12
13
import Card from ' ./card.vue' ;
13
14
import Countdown from ' ./countdown.vue' ;
15
+ import CountdownSlot from ' ./countdown-slot.vue' ;
14
16
import CN from ' ../index.zh-CN.md' ;
15
17
import US from ' ../index.en-US.md' ;
16
18
import { defineComponent } from ' vue' ;
@@ -22,6 +24,7 @@ export default defineComponent({
22
24
Unit ,
23
25
Card ,
24
26
Countdown ,
27
+ CountdownSlot ,
25
28
},
26
29
setup() {
27
30
return {};
You can’t perform that action at this time.
0 commit comments