快应用的onblur

快应用的onblur事件不会自动触发

  1. <input
  2. id="ANU_INPUT"
  3. class="input-city"
  4. value={this.state.inputValue}
  5. placeholder={this.props.placeholder}
  6. placeholder-style="color:#b2b2b2;"
  7. onBlur={this.handleBlur}
  8. onFocus={this.handleFocus}
  9. onChange={this.handleKeyInput}
  10. />

需要为此元素添加一个ID,然后在某个类似失去焦点的时机触发它

  1. emitBlur(){
  2. if (process.env.ANU_ENV === 'quick') {
  3. this.wx.$element('ANU_INPUT').focus({ focus: false });
  4. }
  5. }