跳到主要内容
版本:3.x

KeyboardAccessory

设置 Input / Textarea 聚焦时键盘上方 CoverView / CoverImage 工具栏视图。需要配置 Taro 插件 @tarojs/plugin-platform-weappenablekeyboardAccessory 参数为 true 后才能使用,请参考:#9548

支持情况:

参考文档

类型

ComponentType<StandardProps>

示例代码

// config/index.js
{
// ...
plugins: [
['@tarojs/plugin-platform-weapp', {
enablekeyboardAccessory: true
}]
]
}
class App extends Component {
render () {
return (
<Textarea holdKeyboard="{{true}}">
<KeyboardAccessory className="container" style={{ height: 50 }} >
<CoverView onClick={() => { TODO }} style={{ flex: 1, background: 'green' }}>1</CoverView>
<CoverView onClick={() => { TODO }} style={{ flex: 1, background: 'red' }}>2</CoverView>
</KeyboardAccessory>
</Textarea>
)
}
}