File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " react-vcode" ,
3- "version" : " 0.0.3 " ,
3+ "version" : " 0.0.4 " ,
44 "description" : " a react verification code component" ,
55 "main" : " dist/index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -75,10 +75,16 @@ class Vcode extends React.Component {
7575 }
7676
7777 /** 组件参数改变 **/
78- componentWillReceiveProps ( nextP ) {
78+ componentWillReceiveProps ( nextP , nextS ) {
7979 if ( this . props . value !== nextP . value ) {
8080 this . onDraw ( nextP . value ) ;
8181 }
82+ if ( this . props . width !== nextP . width || this . props . height !== nextP . height ) {
83+ this . setState ( {
84+ width : nextP . width ,
85+ height : nextP . height ,
86+ } ) ;
87+ }
8288 }
8389
8490 /** 用户点击的验证码图片 **/
@@ -124,7 +130,6 @@ class Vcode extends React.Component {
124130 div . appendChild ( dom ) ;
125131 }
126132 } else {
127- console . log ( '走这里' ) ;
128133 const uW = this . state . width / this . state . len ; // 每个字符占的宽度
129134 for ( let i = 0 ; i < this . state . len ; i ++ ) {
130135 const dom = document . createElement ( 'span' ) ;
You can’t perform that action at this time.
0 commit comments