在React中将光标更改为自定义光标

时间:2019-04-10 08:57:15

标签: reactjs

我正在尝试将React应用程序中的光标更改为自定义光标,但是我无法做到这一点。

我确认这样做:

<div style={{cursor: 'crosshair'}}></div>

可以,但是当我尝试通过以下方式使用光标时:

import swordIcon from '../sword.ani'
style={{cursor: swordIcon}}

 style={{cursor: `${swordIcon}, auto`}}

或路径

style={{cursor: 'url("../sword.ani"), auto'}}

没有一个有效。在上一个示例中,我得到了 “代理错误:无法将localhost:3000的请求/assets/sprites/cursor/sword.ani代理到http://localhost:5000/ 但是我认为禁用代理不会在这里改变任何东西

0 个答案:

没有答案