Uncaught TypeError: Cannot read property 'trim' of undefined

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

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

posted on 2018-07-02 16:35  luziluck  阅读(4549)  评论(0编辑  收藏  举报

导航