我正在尝试通过svg更改我的reactJS应用中的光标(我需要能够更改光标的大小和颜色)
const svg =
`url("data:image/svg+xml,${encodeURIComponent(renderToStaticMarkup(<SvgSymb {...props} />))}"), default`;
this.props.updateStyle({ '--cust-cursor': svg });
然后在我的CSS中以这种方式调用
* {
cursor: var(--cust-cursor) !important;
}
这很好用,但是不幸的是我请求页面上每个元素的这个svg,这导致性能问题。知道我该如何以不同的方式进行管理吗?我在电子中运行此应用程序。 谢谢!