Skip to content

Commit 4a1494c

Browse files
author
Jiaqi Liu
committed
feat: support validation state className
1 parent 68b32e3 commit 4a1494c

19 files changed

+112
-41
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Happy to use react-formutil in the project based on `react-bootstrap` ^\_^
5757
* [`ToggleButtonGroup`](#togglebuttongroup)
5858
* [`CheckboxGroup` `RadioGroup` `SwitchGroup`](#checkboxgroup-radiogroup-switchgroup)
5959
- [FAQ](#faq)
60+
+ [`使用 addons/InputGroup 时错误提示不显示`](#使用-addonsinputgroup-时错误提示不显示)
6061
+ [`给组件设置的 onChange、onFocus 等方法无效、不执行`](#给组件设置的-onchangeonfocus-等方法无效不执行)
6162
+ [`在生产环境(NODE_ENV==='production')部分组件调用有异常?`](#在生产环境node_envproduction部分组件调用有异常)
6263

@@ -68,22 +69,22 @@ Happy to use react-formutil in the project based on `react-bootstrap` ^\_^
6869

6970
由于目前流行的`bootstrap`版本主要有`v3``v4`,其对应的`react-bootstrap`也有两个相对应的版本,所以我们也提供了两个版本供选择下载。
7071

71-
该版本适用于 `bootstrap@4.x``react-bootstrap@1.x`**如果你项目中使用的是 `bootstrap@3.x``react-bootstrap@0.32.x`,请查看 [react-bootstrap-formutil v3](https://github.com/qiqiboy/react-bootstrap-formutil/tree/v3)**
72+
该版本适用于 `bootstrap@4.x``react-bootstrap@1.x`**如果你项目中使用的是 `bootstrap@3.x``react-bootstrap@0.32.x`,请查看 [react-bootstrap-formutil@classic](https://github.com/qiqiboy/react-bootstrap-formutil/tree/v3)**
7273

7374
```bash
7475
# npm
75-
npm install react-bootstrap-formutil --save
76+
npm install react-bootstrap-formutil@next --save
7677

7778
# yarn
78-
yarn install react-bootstrap-formutil
79+
yarn install react-bootstrap-formutil@next
7980
```
8081

8182
### 使用 Usage
8283

8384
> `react-bootstrap-formutil` 整合了 `react-formutil` 的组件,所以可以直接从`react-bootstrap-formutil`中导出所需要的
8485
> `react-formutil` 组件。不用单独从 `react-formutil` 中导出。
8586
86-
**本文档适用于 `bootstrap@4.x``react-bootstrap@1.x` 版本,如果你要查看早期`react-bootstrap@0.32`的文档,请查看 [react-bootstrap-formutil v3](https://github.com/qiqiboy/react-bootstrap-formutil/tree/v3)**
87+
**本文档适用于 `bootstrap@4.x``react-bootstrap@1.x` 版本,如果你要查看早期`react-bootstrap@0.32`的文档,请查看 [react-bootstrap-formutil@classic](https://github.com/qiqiboy/react-bootstrap-formutil/tree/v3)**
8788

8889
先看一个使用示例(点击查看在线完整示例 :
8990
[react-bootstrap-formutil on codesandbox.io](https://codesandbox.io/s/rmj2l1o80o)):
@@ -490,6 +491,16 @@ import { CheckboxGroup, RadioGroup, SwitchGroup } from 'react-bootstrap-formutil
490491

491492
### FAQ
492493

494+
#### `使用 addons/InputGroup 时错误提示不显示`
495+
496+
请添加以下 css 即可:
497+
498+
```css
499+
.input-group.is-invalid ~ .invalid-feedback {
500+
display: block;
501+
}
502+
```
503+
493504
#### `给组件设置的 onChange、onFocus 等方法无效、不执行`
494505

495506
`FormGroup`会覆盖掉直接添加到 react-bootstrap 组件上的`onFocus` `onBlur` `onChange`方法,所以如果需要这三个事件方法,需要添加到
@@ -503,7 +514,7 @@ import { CheckboxGroup, RadioGroup, SwitchGroup } from 'react-bootstrap-formutil
503514

504515
#### `在生产环境(NODE_ENV==='production')部分组件调用有异常?`
505516

506-
如果在生产环境,发现例如`Checkbox` `Radio` `Switch`等组件无法正确捕获用户输入的值,这种情况一般是由于项目中使用了`babel-plugin-import`插件。
517+
如果在生产环境,发现例如`Form.Check` `ToggleButtonGroup` 等组件无法正确捕获用户输入的值,这种情况一般是由于项目中使用了`babel-plugin-import`插件。
507518

508519
`react-bootstrap-formutil`中是使用 `import { FormControl } from 'react-bootstrap'` 这种写法来调用 `FormControl` 组件的,而`babel-plugin-import`插件会将项目源代码中的类似语句,替换成`import FormControl from 'react-bootstrap/lib/FormControl'`。这两种写法获取到的`Switch`其实并不是严格意义上的相等,前者是对后者的又一层导出封装。
509520

dist/react-bootstrap-formutil.cjs.development.js

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-bootstrap-formutil.cjs.development.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)