可以这样写,有值的时候trim,没值的时候为空

let user = this.state.name.trim() || '';

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
猜你喜欢
  • 2021-10-03
  • 2021-10-10
  • 2021-09-09
  • 2021-08-28
  • 2021-07-09
  • 2022-12-23
相关资源
相似解决方案