File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,15 @@ import Vcode from 'react-vcode';
2222 <Vcode />
2323
2424````
25+ ## 3. 服务端渲染
26+ ```
27+ import Vcode from 'react-vcode';
2528
26- ## 3. 自定义参数
29+ <Vcode id="vcode" />
30+ ```
31+ 需要自己加个id, 不然服务端渲染和本地渲染,id变了会报错,因为Vcode内部使用了随机值
32+
33+ ## 4. 自定义参数
2734
2835可自行设置覆盖原有值
2936
@@ -75,9 +82,9 @@ options:{ // 验证码相关自定义参数
7582 ' #008888' ,
7683 ],
7784 lineHeightMin: 1 , // 线的粗细最小值
78- lineHeightMax: 1 , // 线的粗细最大值
79- lineWidthMin: 20 , // 线的长度最小值
80- lineWidthMax: 60 , // 线的长度最大值
85+ lineHeightMax: 2 , // 线的粗细最大值
86+ lineWidthMin: 40 , // 线的长度最小值
87+ lineWidthMax: 100 , // 线的长度最大值
8188}
8289
8390// 例子:
@@ -89,14 +96,14 @@ options:{ // 验证码相关自定义参数
8996/ >
9097````
9198
92- ## 4 . 手动刷新验证码
99+ ## 5 . 手动刷新验证码
93100``` javascript
94101< Vcode ref= {(obj )=> this .vcode = obj} / >
95102
96103this .vcode .onClick (); // 调用内部的onClick方法可刷新验证码
97104```
98105
99- ## 5 . 额外说明
106+ ## 6 . 额外说明
100107
101108- 之前用过一个验证码插件叫 vcode.js, 不知道作者。 本react-vcode是通过vcode.js的源码进行修改加工,转成了react组件。感谢原作者。
102109
You can’t perform that action at this time.
0 commit comments