mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-11-30 02:08:12 +08:00
docs(components): [table-v2] refine inline editing examples (#18018)
This commit is contained in:
parent
6ce83d38a7
commit
7c442f172b
@ -15,7 +15,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import { ref } from 'vue'
|
import { ref, withKeys } from 'vue'
|
||||||
import { ElInput } from 'element-plus'
|
import { ElInput } from 'element-plus'
|
||||||
|
|
||||||
import type { FunctionalComponent } from 'vue'
|
import type { FunctionalComponent } from 'vue'
|
||||||
@ -25,16 +25,26 @@ type SelectionCellProps = {
|
|||||||
value: string
|
value: string
|
||||||
intermediate?: boolean
|
intermediate?: boolean
|
||||||
onChange: (value: string) => void
|
onChange: (value: string) => void
|
||||||
|
onBlur: () => void
|
||||||
|
onKeydownEnter: () => void
|
||||||
forwardRef: (el: InputInstance) => void
|
forwardRef: (el: InputInstance) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const InputCell: FunctionalComponent<SelectionCellProps> = ({
|
const InputCell: FunctionalComponent<SelectionCellProps> = ({
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
|
onBlur,
|
||||||
|
onKeydownEnter,
|
||||||
forwardRef,
|
forwardRef,
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<ElInput ref={forwardRef as any} onInput={onChange} modelValue={value} />
|
<ElInput
|
||||||
|
ref={forwardRef as any}
|
||||||
|
onInput={onChange}
|
||||||
|
onBlur={onBlur}
|
||||||
|
onKeydown={withKeys(onKeydownEnter, ['enter'])}
|
||||||
|
modelValue={value}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user