Files
element-plus/packages/components/date-picker/src/date-picker-com/basic-cell-render.tsx
btea 2c1b1ca62c fix(components): [date-picker] slot not take effect when type is month (#17748)
* fix(components): [date-picker] slot not take effect when type is month

* feat: type year support slot

* fix: type

* fix: update

* style: update

* fix: test
2024-08-09 11:15:53 +08:00

23 lines
684 B
TypeScript

import { defineComponent, inject, renderSlot } from 'vue'
import { useNamespace } from '@element-plus/hooks'
import { ROOT_PICKER_INJECTION_KEY } from '../constants'
import { basicCellProps } from '../props/basic-cell'
export default defineComponent({
name: 'ElDatePickerCell',
props: basicCellProps,
setup(props) {
const ns = useNamespace('date-table-cell')
const { slots } = inject(ROOT_PICKER_INJECTION_KEY)!
return () => {
const { cell } = props
return renderSlot(slots, 'default', { ...cell }, () => [
<div class={ns.b()}>
<span class={ns.e('text')}>{cell?.renderText ?? cell?.text}</span>
</div>,
])
}
},
})