Browse Source

处理自动跳到富文本

魏熙美 5 years ago
parent
commit
f27d9cfc23

+ 12
- 0
src/components/Wangedit/Wangedit.jsx View File

55
       }
55
       }
56
     }
56
     }
57
   }
57
   }
58
+
59
+  /**
60
+   *增加这个 shouldComponentUpdate 生命函数
61
+    处理自动聚焦到富文本上
62
+   *
63
+   * @param {*} nextProps
64
+   * @returns
65
+   * @memberof Wangedit
66
+   */
67
+  shouldComponentUpdate(nextProps) {
68
+    return nextProps.value !== this.editor.txt.html()
69
+  }
58
 }
70
 }
59
 
71
 
60
 export default Wangedit
72
 export default Wangedit

+ 3
- 2
src/pages/building/list/add/components/buildingProjectType.jsx View File

61
           position: 'relative',
61
           position: 'relative',
62
           border: '1px solid #eee',
62
           border: '1px solid #eee',
63
           borderRadius: '4px',
63
           borderRadius: '4px',
64
-          marginTop:'16px'
64
+          marginTop: '16px',
65
         }}>
65
         }}>
66
 
66
 
67
           <p style={{ padding: '20px', borderBottom: '1px solid #eee' }}>{this.props.type.buildingTypeName || ''}  <Button type="link" style={{ position: 'absolute', right: '16px' }} icon="close" onClick={() => this.close()} /></p>
67
           <p style={{ padding: '20px', borderBottom: '1px solid #eee' }}>{this.props.type.buildingTypeName || ''}  <Button type="link" style={{ position: 'absolute', right: '16px' }} icon="close" onClick={() => this.close()} /></p>
140
     const updateProjectDate = this.updateProjectType(tempDate)
140
     const updateProjectDate = this.updateProjectType(tempDate)
141
     console.log('updateProjectDate: ', updateProjectDate)
141
     console.log('updateProjectDate: ', updateProjectDate)
142
     this.setState({ data: updateProjectDate })
142
     this.setState({ data: updateProjectDate })
143
+    this.setState({ defaultCheckboxValue: updateProjectDate.map(item => item.buildingTypeId) })
143
   }
144
   }
144
 
145
 
145
   onClose = e => {
146
   onClose = e => {
239
           onOk={this.handleOk}
240
           onOk={this.handleOk}
240
           onCancel={this.handleCancel}
241
           onCancel={this.handleCancel}
241
         >
242
         >
242
-          <Checkbox.Group options={this.state.projectType.map(item => ({ label: item.buildingTypeName, value: item.buildingTypeId }))} defaultValue={this.state.defaultCheckboxValue} onChange={e => this.onCheckboxChange(e)} />
243
+          <Checkbox.Group options={this.state.projectType.map(item => ({ label: item.buildingTypeName, value: item.buildingTypeId }))} onChange={e => this.onCheckboxChange(e)} value={this.state.defaultCheckboxValue}/>
243
         </Modal>
244
         </Modal>
244
         <Row type="flex" justify="space-between">
245
         <Row type="flex" justify="space-between">
245
           {
246
           {