美文网首页
Error: Minified React error #31;

Error: Minified React error #31;

作者: Rose_yang | 来源:发表于2021-12-09 20:11 被阅读0次

报错详情如下:

react-dom.production.min.js:141 Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7B_isAMomentObject%2C%20_i%2C%20_f%2C%20_isUTC%2C%20_pf%2C%20_locale%2C%20_d%2C%20_isValid%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

原因是这样的:

日期数据格式不支持,渲染的是无效的日期数据。无效的日期值。 table组件的columns中render中使用moment时写法错误 导致的报错

{
 title: '结束时间',
 dataIndex: 'end',
 render: text => {
  const time = moment(text, 'YYYY-MM-DD HH:mm:ss');


  return <span>{ time }</span>;
 }
},

正确写法:

render: text => {
 const time = moment(text).format('YYYY-MM-DD HH:mm:ss');


 return <span>{ time }</span>;
}

相关文章

网友评论

      本文标题:Error: Minified React error #31;

      本文链接:https://www.haomeiwen.com/subject/tiqhtrtx.html