React编译代码提示报错信息:
React编译代码提示报错信息:
Warning: A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed "javascript:;".
原因:React提示在未来的版本中作为安全预防React将阻止Javascript URL,React将不再使用"javascript:;"。
错误代码:
{
title: '操作',
dataIndex: 'action',
width: 80,
sorter: false,
render: (v, record) => {
return <a href='javascript:;' onClick={() => this.handleGoApproval(record)}><WrapperIcon tooltip='处理' type='edit' /></a>;
},
},
解决:
将“javascript:;”改为“#”或者“#!”。
{
title: '操作',
dataIndex: 'action',
width: 80,
sorter: false,
render: (v, record) => {
return <a href='#!' onClick={() => this.handleGoApproval(record)}><WrapperIcon tooltip='处理' type='edit' /></a>;
},
},