File tree Expand file tree Collapse file tree 3 files changed +27
-19
lines changed Expand file tree Collapse file tree 3 files changed +27
-19
lines changed Original file line number Diff line number Diff line change @@ -35,17 +35,21 @@ class HostKeyHash extends Component {
3535 let redisKey = this . props . redisKey ;
3636 this . refreshValue ( redisKey ) ;
3737 }
38+
3839 /**
39- * 在组件接收到一个新的 prop (更新后)时被调用。这个方法在初始化render时不会被调用。
40+ *组件更新
4041 *
41- * @param {* } nextProps
42- * @memberof HostKeyHash
42+ * @param {* } prevProps
43+ * @memberof HostKeyString
4344 */
44- UNSAFE_componentWillReceiveProps ( nextProps ) {
45- this . props = nextProps ;
46- let redisKey = this . props . redisKey ;
47- this . refreshValue ( redisKey ) ;
45+ componentDidUpdate ( prevProps ) {
46+ if ( this . props . redisKey !== prevProps . redisKey ) {
47+ this . props = prevProps ;
48+ let redisKey = this . props . redisKey ;
49+ this . refreshValue ( redisKey ) ;
50+ }
4851 }
52+
4953 /**
5054 * table columns
5155 *
Original file line number Diff line number Diff line change @@ -36,15 +36,17 @@ class HostKeySet extends Component {
3636 this . refreshValue ( redisKey ) ;
3737 }
3838 /**
39- * 在组件接收到一个新的 prop (更新后)时被调用。这个方法在初始化render时不会被调用。
39+ *组件更新
4040 *
41- * @param {* } nextProps
41+ * @param {* } prevProps
4242 * @memberof HostKeyString
4343 */
44- UNSAFE_componentWillReceiveProps ( nextProps ) {
45- this . props = nextProps ;
46- let redisKey = this . props . redisKey ;
47- this . refreshValue ( redisKey ) ;
44+ componentDidUpdate ( prevProps ) {
45+ if ( this . props . redisKey !== prevProps . redisKey ) {
46+ this . props = prevProps ;
47+ let redisKey = this . props . redisKey ;
48+ this . refreshValue ( redisKey ) ;
49+ }
4850 }
4951 /**
5052 * table columns
Original file line number Diff line number Diff line change @@ -37,15 +37,17 @@ class HostKeySortSet extends Component {
3737 this . refreshValue ( redisKey ) ;
3838 }
3939 /**
40- * 在组件接收到一个新的 prop (更新后)时被调用。这个方法在初始化render时不会被调用。
40+ *组件更新
4141 *
42- * @param {* } nextProps
42+ * @param {* } prevProps
4343 * @memberof HostKeyString
4444 */
45- UNSAFE_componentWillReceiveProps ( nextProps ) {
46- this . props = nextProps ;
47- let redisKey = this . props . redisKey ;
48- this . refreshValue ( redisKey ) ;
45+ componentDidUpdate ( prevProps ) {
46+ if ( this . props . redisKey !== prevProps . redisKey ) {
47+ this . props = prevProps ;
48+ let redisKey = this . props . redisKey ;
49+ this . refreshValue ( redisKey ) ;
50+ }
4951 }
5052 /**
5153 * table columns
You can’t perform that action at this time.
0 commit comments