mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
feat(components): [virtual-table] cell (#7068)
- Add Cell component props definition - Implemented Cell component
This commit is contained in:
parent
cea5fbd8e9
commit
aeb2b6fc4d
21
packages/components/table-v2/src/cell.ts
Normal file
21
packages/components/table-v2/src/cell.ts
Normal 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>
|
17
packages/components/table-v2/src/table-cell.tsx
Normal file
17
packages/components/table-v2/src/table-cell.tsx
Normal 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
|
Loading…
Reference in New Issue
Block a user