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>;
}
网友评论