feat(components): [virtual-table] cell (#7068)

- Add Cell component props definition
- Implemented Cell component
This commit is contained in:
JeremyWuuuuu 2022-04-09 11:38:04 +08:00 committed by GitHub
parent cea5fbd8e9
commit aeb2b6fc4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import { buildProps, definePropType } from '@element-plus/utils'
import type { ExtractPropTypes } from 'vue'
import type { Column } from './types'
export const tableV2CellProps = buildProps({
class: String,
cellData: {
type: definePropType<any>([String, Boolean, Number, Object]),
},
column: {
type: definePropType<Column<any>>(Object),
},
columnIndex: Number,
rowData: {
type: definePropType<any>(Object),
},
rowIndex: Number,
} as const)
export type TableV2CellProps = ExtractPropTypes<typeof tableV2CellProps>

View File

@ -0,0 +1,17 @@
import { defineComponent } from 'vue'
import type { TableV2CellProps } from './cell'
const TableV2Cell = defineComponent((props: TableV2CellProps, { slots }) => {
return (
<div class={props.class}>
{slots.default
? slots.default(props)
: String.prototype.toString.call(props.cellData)}
</div>
)
})
TableV2Cell.name = 'TableV2Cell'
export default TableV2Cell