You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< docs >
-- -
order : 12
title :
zh - CN : 自定义渲染
en - US : Custum Time
-- -
# # zh - CN
增加自定义渲染功能 , 在默认 ` slot ` 中 , 你可以设置任何你想渲染的组件 。
# # en - US
Added custom rendering function , in the default ` slot ` , you can set any component you want to render .
< / docs >
< template >
< a -space direction = "vertical" :size ="12" >
< a -date -picker v -model :value ="time1" placeholder = "Select Time" @ok ="onOk" >
< span > { { time1 ? time1 . toString ( ) : 'SelectTime' } } < / span >
< / a - d a t e - p i c k e r >
< a -range -picker v -model :value ="time2" >
< span >
{ { time2 ? time2 . toString ( ) : '请选择' } }
< / span >
< / a - r a n g e - p i c k e r >
< / a - s p a c e >
< / template >
< script lang = "ts" >
import { Dayjs } from 'dayjs' ;
import { defineComponent , ref } from 'vue' ;
export default defineComponent ( {
setup ( ) {
const time1 = ref < Dayjs > ( ) ;
const time2 = ref < Dayjs > ( ) ;
const onOk = ( value : Dayjs ) => {
console . log ( 'onOk: ' , value ) ;
} ;
const clearTime = ( ) => {
time1 . value = undefined ;
} ;
return {
time1 ,
time2 ,
onOk ,
clearTime ,
} ;
} ,
} ) ;
< / script >