Skip to content

Commit fe29068

Browse files
committed
feat: 数字键盘的 confirmText 支持换行展示
1 parent c55c5a3 commit fe29068

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/components/number-keyboard/demos/demo1.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, { useState } from 'react'
2-
import { List, Input, Dialog, NumberKeyboard, Toast, Button } from 'antd-mobile'
1+
import { Button, Dialog, Input, List, NumberKeyboard, Toast } from 'antd-mobile'
32
import { DemoBlock } from 'demos'
3+
import React, { useState } from 'react'
44

55
export default () => {
66
const [visible, setVisible] = useState<any>('')
@@ -66,6 +66,9 @@ export default () => {
6666
{/* 添加 readOnly 阻止原生键盘弹出 */}
6767
<Input placeholder='请输入内容' value={value} readOnly />
6868
</List.Item>
69+
<List.Item onClick={() => openKeyboard('demo7')}>
70+
确认按钮文案支持换行
71+
</List.Item>
6972
</List>
7073
</DemoBlock>
7174
<NumberKeyboard
@@ -112,6 +115,14 @@ export default () => {
112115
onDelete={onDelete}
113116
customKey='X'
114117
/>
118+
<NumberKeyboard
119+
visible={visible === 'demo3'}
120+
onClose={actions.onClose}
121+
onInput={actions.onInput}
122+
onDelete={actions.onDelete}
123+
showCloseButton={false}
124+
confirmText={'先签约\n再转入'} // {'\n'} 可以而 '\n' 不行,后者会被转义为 '\\n'
125+
/>
115126
</>
116127
)
117128
}

src/components/number-keyboard/number-keyboard.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
height: 144px;
121121
font-size: 16px;
122122
border: none;
123+
white-space: pre-line;
123124
}
124125
}
125126
}

0 commit comments

Comments
 (0)