vue-drag-resize icon indicating copy to clipboard operation
vue-drag-resize copied to clipboard

vue3 drag-handle _uid 的问题

Open ghost opened this issue 4 years ago • 5 comments

设置了 drag-handle 后,控制台报 this._uid is undefined 错误。 定位到源代码是: if (this.dragHandle && target.getAttribute('data-drag-handle') !== this._uid.toString()) { return; } can't access _uid in vue3

ghost avatar May 10 '21 02:05 ghost

I have this warning when enable drag handle [Vue warn]: Unhandled error during execution of native event handler at <VueDragResize dragHandle=".drag" key=0 w=140 ... > Please help. Thanks in advance

ntgraph avatar Feb 18 '22 19:02 ntgraph

怎么解决呢?

augushong avatar May 06 '22 10:05 augushong

怎么解决呢?

我把代码拉下来,自己做了一点点小修改,然后重新build。 Snipaste_2022-05-06_19-57-33

ghost avatar May 06 '22 11:05 ghost

感谢回复。 我干脆直接自己写了一个拖动。 这个组件在vue2很好用。

augushong avatar May 06 '22 12:05 augushong

the problem is this._uid is undefined in Vue 3 unlike in Vue 2 which works perfectly.

so when using the dragHandle prop this line is causing the issue dragHandle.setAttribute('data-drag-handle', this._uid);

the only solution is to modify the this.uid by your own ID generator function or a utility that does this and rebuild as you did.

unfortunately, the library is not well maintained at this point so there are some Vue 3 issues. 😞

I hope @kirillmurashov gets back or at least opens up the door for other maintainers.

hamedbaatour avatar Dec 24 '22 16:12 hamedbaatour