我正在尝试在响应中禁用鼠标事件。我尝试了pointer-events: none
和document.body.style.cursor = 'none'
。两者都不起作用。我在全身或App上尝试过。无法正常工作。我基本上想将鼠标指针隐藏一段时间,然后放回去。
答案 0 :(得分:1)
好,您需要包装该对象
class Hello extends React.Component {
render() {
return <div style={{cursor: 'none'}}>
<button style={{ pointerEvents: 'none'}}>
Hello {this.props.name}
</button>
</div>;
}
}
ReactDOM.render(
<Hello name="World"/>,
document.body
);
根据CSS的基础,不能合并pointerEvents: 'none',cursor: 'none'
直接。
您需要包装该项目并像此处这样分开样式
演示: https://jsfiddle.net/limitbrk/g9w7es5p/