mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
* 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
23 lines
684 B
TypeScript
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>,
|
|
])
|
|
}
|
|
},
|
|
})
|