首页 新闻 赞助 找找看

vue 如何设置自定义cursor样式?

0
悬赏园豆:10 [已关闭问题] 关闭于 2023-03-07 14:26

我写了段自定义指令

resetMap(el){
        const optDom = el
        const resetEl = document.createElement('div')

        resetEl.style = 'position: absolute; right: 0; bottom: 0px; width: 100px; height: 100px; background: inherit; margin: auto; z-index: 1; cursor: url('+ require('@/assets/icons/svg/reset.svg') +') auto; pointer-events: auto;'; // TODO  custom cursor style

        resetEl.addEventListener('dblclick', function (e) {
          e.preventDefault(); // 
          optDom.style.width = '36%'
          optDom.style.height = '32.3%'
          optDom.style.right = '0'
          optDom.style.bottom = '0'
          
        }, true)
        
        optDom.appendChild(resetEl);
      }

这里有段设置样式的,里面我写了cursor: url('+ require('@/assets/icons/svg/reset.svg') +') auto;,但是好像不生效,我这个图标是存在的

  resetEl.style = 'position: absolute; right: 0; bottom: 0px; width: 100px; height: 100px; background: inherit; margin: auto; z-index: 1; cursor: url('+ require('@/assets/icons/svg/reset.svg') +') auto; pointer-events: auto;'; // TODO  custom cursor style


放张代码图,容易看些

问题补充:


放张代码图,容易看些

echo_lovely的主页 echo_lovely | 小虾三级 | 园豆:1422
提问于:2023-03-07 13:48
< >
分享
所有回答(1)
0

我这里 url()auto之间少了个,, cursor: url('+ require('@/assets/icons/svg/reset.svg') +') auto;

echo_lovely | 园豆:1422 (小虾三级) | 2023-03-07 14:26
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册