提交 80e5bb3f 编写于 作者: D DCloud_LXH

feat: input、textarea support confirm-hold

上级 02c4a019
......@@ -116,10 +116,12 @@ export default /*#__PURE__*/ defineBuiltInComponent({
if ((event as KeyboardEvent).key !== 'Enter') {
return
}
const input = event.target as HTMLInputElement
event.stopPropagation()
trigger('confirm', event, {
value: (event.target as HTMLInputElement).value,
value: input.value,
})
!props.confirmHold && input.blur()
}
return () => {
let inputNode =
......
......@@ -97,7 +97,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
if (isDone.value) {
confirm(event)
const textarea = event.target as HTMLTextAreaElement
textarea.blur()
!props.confirmHold && textarea.blur()
}
}
......
......@@ -132,6 +132,10 @@ export const props = /*#__PURE__*/ extend(
type: String,
default: 'done',
},
confirmHold: {
type: Boolean,
default: false,
},
},
keyboardProps
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册