Adding Drag and Drop to Your Vue 3 Project

  Рет қаралды 85,847

LearnVue

LearnVue

Күн бұрын

Пікірлер: 80
@lehlohonolomotsoeneng6672
@lehlohonolomotsoeneng6672 8 ай бұрын
After two libraries and more than 2 hours and not getting it right, I watched your tutorial and got it right and my application works like a charm. Thank you!
@ashemukisa4727
@ashemukisa4727 3 жыл бұрын
The tutorial is clear and builds the solution from first principles which is a great way for me modify it. Thanks Matt.
@LearnVue
@LearnVue 3 жыл бұрын
Glad to hear - that's always my goal with these videos!
@astrosoup
@astrosoup 3 жыл бұрын
This was so well done. High quality content and so helpful, thank you
@LearnVue
@LearnVue 3 жыл бұрын
thanks for watching!
@tomparke2407
@tomparke2407 2 жыл бұрын
Always appreciate tutorials utilising browser api standards over a hot library. People will still be able to use this video in 2 years.
@casmironyeka1104
@casmironyeka1104 5 ай бұрын
Two years later and this video just saved me right now! 😂
@PrashantNirgun
@PrashantNirgun 2 жыл бұрын
This tutorials is very good it uses Vanila Js instead of additional libraries just few bytes of code and that's all. Good work keep it up.
@perfect.stealth
@perfect.stealth 2 жыл бұрын
I just found this channel. I am not disappointed. Thanks for sharing!
@_rtdp_
@_rtdp_ Жыл бұрын
I came here from your web app. You web app is awesome dude... You just earned a subscriber...
@DaneVideo
@DaneVideo 3 жыл бұрын
This video helped me get drag and drop working in my app in less than an hour
@00AnnaEszter
@00AnnaEszter 2 жыл бұрын
Thank you for the this great beginners guide! I would love to see a second part where the inner values of the draggable elements are changing: like if C is a basket and A and B are elements that we can add to the basket so the value of C is growing and the number (on) of A and B are reducing.
@mikehillbilly4079
@mikehillbilly4079 Жыл бұрын
Love this concise, direct and clear tutorial. Very professional
@rashadrivera100
@rashadrivera100 3 жыл бұрын
Very nice! Appreciate how you layout all the intricate details.
@LearnVue
@LearnVue 3 жыл бұрын
Thank you so much! I had a lot of fun making this video.
@carlosenriquepineiro375
@carlosenriquepineiro375 19 күн бұрын
THANKS! I'm building something like a kanban board and I think this is exactly what I need. I was analysing for discontinued libraries. I just have to check what has changes in this years.
@MattMcT
@MattMcT 2 жыл бұрын
Coming through again, my man! Hope you are well and thank you as always for your solid vid vibe!
@araputrevor5103
@araputrevor5103 5 ай бұрын
Awesome dude, you made it so easy for me to get started.
@christiancolewan
@christiancolewan 8 күн бұрын
Thanks I leaned about the html drag and drop API
@titusayyasamy3035
@titusayyasamy3035 3 жыл бұрын
this explanation is outstanding
@PopescuMarian
@PopescuMarian 3 жыл бұрын
great, finally some good vue tutorials
@LearnVue
@LearnVue 3 жыл бұрын
More to come!
@chamberlainpi
@chamberlainpi 3 жыл бұрын
Why nuke the “setup” attribute from the get go? Are there any reasons this couldn’t have been accomplished with the new setup syntax sugar?
@herisetrarazafiarison4563
@herisetrarazafiarison4563 2 жыл бұрын
Very clear and straight video, thank you
@HN01-u1b
@HN01-u1b 2 жыл бұрын
thank you, got it on the first try following your tutorial
@陈大锤-q1s
@陈大锤-q1s 2 жыл бұрын
Your video is so intuitive and clear, thank you.
@MrBalobba
@MrBalobba 3 жыл бұрын
I love vue and I love this channel. Keep up the good work!
@codybontecou
@codybontecou 3 жыл бұрын
For anyone running into the error `Uncaught TypeError: Cannot set properties of undefined (setting 'list')`, I fixed this by setting my item ID's to strings. const items = ref([ { id: '0', title: 'Item A', list: 1 }, { id: '1', title: 'Item B', list: 1 }, { id: '2', title: 'Item C', list: 2 }, ])
@dibbyo456
@dibbyo456 2 жыл бұрын
Another high quality content. 👌
@AlphaWatt
@AlphaWatt 2 жыл бұрын
Excellent video. Super clear instruction and very helpful info. Thanks!
@ricardovergara9852
@ricardovergara9852 2 жыл бұрын
Great video! You make it look easy to follow! thanks
@vitordossantosbrandao8325
@vitordossantosbrandao8325 Жыл бұрын
Really really helpful. Thank you very much!
@yoanestradablanco1608
@yoanestradablanco1608 2 жыл бұрын
good content and successes my bro
@sammieboy793
@sammieboy793 3 жыл бұрын
Is there a way to figure out how to drag & drop to change the order of the items in the list?
@AchariPhp
@AchariPhp 3 жыл бұрын
I'm also looking for this solution.. did you fixed this one Sam.
@thefeymesaleng
@thefeymesaleng 2 жыл бұрын
@@AchariPhp 2 months late, but the usual way of doing it is having another elements inside the item itself and positioned it at the top and bottom that take a drag/drop event/function. So if a dragged item dropped on top positioned element of an item, it will run a function that inserting the dragged item to one index behind the item, and the same for the bottom element of an item, but with the add one index.
@lawrencesmith9059
@lawrencesmith9059 8 ай бұрын
A truly great video.
@vinothrenga1
@vinothrenga1 2 жыл бұрын
Awesome, thanks dude.😊
@thomasderidder608
@thomasderidder608 2 жыл бұрын
It worked perfectly, thanks a lot!
@casmironyeka1104
@casmironyeka1104 5 ай бұрын
Thanks so much for this.
@paul2DD
@paul2DD 2 жыл бұрын
dataTransfer stores Strings, for those who get into error "Uncaught TypeError: item is undefined", you must convert itemId to string -> const item = items.value.find((item) => item.id === parseInt(itemId))
@SusanthCom
@SusanthCom 3 жыл бұрын
Good job ❤️❤️❤️. Thanks 👍
@LearnVue
@LearnVue 3 жыл бұрын
Thank you so much for watching 😊
@AgnesPalit_adirgapalit
@AgnesPalit_adirgapalit 3 жыл бұрын
Hi Do you have a way so the object that we drag and drop only stick into axis x or y (move horisontaly/vertically only)?
@stevensadler1685
@stevensadler1685 3 жыл бұрын
For me, dragging and dropping an item is moving it to the new group, but there is no semi-transparent version of the item following the mouse pointer. Instead my mouse pointer turns into a circle with a line through it - the "no" symbol. Any idea what I missed?
@LearnVue
@LearnVue 3 жыл бұрын
hmm i haven't seen that before. just from my experience, it could be one of the settings in the drag and drop api - since it is pretty specific on the requirements needed. so just make sure that all of those match. or it could maybe it a browser-specific issue.
@markg5986
@markg5986 2 жыл бұрын
Great tutorial. Thanks!
@cozilic
@cozilic 3 жыл бұрын
If you are doing this via a Laravel blade view, don't forget to include the props export default { props:['itemID'], setup() {.... thats what i had to do anyways.
@itxhaseeb5794
@itxhaseeb5794 Жыл бұрын
Excellent Work
@dfeverx-en
@dfeverx-en 3 жыл бұрын
super helpful
@LearnVue
@LearnVue 3 жыл бұрын
glad you think so!
@jntaca
@jntaca 3 жыл бұрын
You're the best.
@LearnVue
@LearnVue 3 жыл бұрын
thanks!
@antifa_communist
@antifa_communist Жыл бұрын
Why did you not use script setup?
@dgenerationx5220
@dgenerationx5220 Жыл бұрын
Can we drop the clone of the elements dragged in vue
@max_nostradamus
@max_nostradamus 9 ай бұрын
Why remove "setup" from the script tag? Its makes vue 3 so much more readable...
@MohdSolihin
@MohdSolihin 3 жыл бұрын
thank you
@user-jt5vm3mi1w
@user-jt5vm3mi1w 2 жыл бұрын
Good tutorial
@siemaneczko9850
@siemaneczko9850 2 жыл бұрын
Will it work on vue2?
@Imaginativeone_DF
@Imaginativeone_DF 2 жыл бұрын
How would I apply this tutorial to a hierarchical tree?
@LearnVue
@LearnVue 2 жыл бұрын
it should be a pretty similar concept, but with nested drop zones. the draggable should ondrop event would still trigger with the id, which you can use to move data around. i haven’t tested this on my computer, but the two things i’d look out for are: 1. making sure events don’t propagate up the component chain in the case of nested drop zones 2. the data structure would be a more complex than the tutorial
@kanundash
@kanundash 3 жыл бұрын
greate video
@JORGEMARTINEZ-ho4wp
@JORGEMARTINEZ-ho4wp 4 жыл бұрын
nice
@oleksiizelenko9357
@oleksiizelenko9357 4 жыл бұрын
super
@sebastianjung3168
@sebastianjung3168 2 жыл бұрын
would be great if these video would have been mobile friendly 🤗
@pedroismael17
@pedroismael17 2 жыл бұрын
for mobile device no works, can any help me?? :(
@gastonmorales3619
@gastonmorales3619 2 жыл бұрын
You'd need to use another API, for mobile devices is not working in this case
@pedroismael17
@pedroismael17 2 жыл бұрын
@@gastonmorales3619 i resolved! :D
@gastonmorales3619
@gastonmorales3619 2 жыл бұрын
Could You share the solution in this reply?
@pedroismael17
@pedroismael17 2 жыл бұрын
Yes, give me a few hours and I'll share it
@SusanthCom
@SusanthCom 2 жыл бұрын
@@pedroismael17 Any link please
@ShadowVipers
@ShadowVipers 2 жыл бұрын
Oh man, I knew about those events, but never realized what they were for.... I ended up building the drag & drop logic from scratch using drag classes and setting it's position based on the cursor pos.... The facepalm is real...
@wahomemutahi1008
@wahomemutahi1008 2 жыл бұрын
Thaaaaaaaaaaaaankyoooooooou
@bibhasash7371
@bibhasash7371 2 жыл бұрын
best
@kafir5801
@kafir5801 Жыл бұрын
Strange this code does not work on Firefox, Opera and Crhome (no errors)
@БехрузАбдувалиев-н5и
@БехрузАбдувалиев-н5и 3 жыл бұрын
Uncaught TypeError: Cannot read property 'dataTransfer' of undefined at Proxy.onDrop (App.vue:34) setup() { const items = ref([ {id: 0, title: 'Item A', list: 1}, {id: 1, title: 'Item B', list: 1}, {id: 2, title: 'Item C', list: 2}, {id: 3, title: 'Item D', list: 2}, ]) const getList = (list) => { return items.value.filter((item) => item.list == list) } const startDrag=(event,item)=>{ console.log(item) event.dataTransfer.dropEffect='move' event.dataTransfer.effectAllowed='move' event.dataTransfer.setData('itemId',item.id) } const onDrop=(event,list)=>{ const itemId=event.dataTransfer.getData('itemId') const item=items.value.find((item)=> item.id ===itemId) item.list=list } return { getList,startDrag,onDrop } } where is mistake?
@fermevc
@fermevc 2 жыл бұрын
When you call startDrag function from the template, you need to put "$event", but I'm just guessing because you didn't share all the code...
@webdev1943
@webdev1943 2 жыл бұрын
thank you
Vue Slots Simplified
7:25
LearnVue
Рет қаралды 58 М.
Animating Vue Router Transitions in Vue 3
12:08
LearnVue
Рет қаралды 54 М.
Who is More Stupid? #tiktok #sigmagirl #funny
0:27
CRAZY GREAPA
Рет қаралды 10 МЛН
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
Build a DropZone (Drag/Drop) Component With Vue 3 (No Library)
30:14
John Komarnicki
Рет қаралды 31 М.
How to Use Vue watchEffect to Track Reactive Dependencies
7:16
Building a Reusable Tabs Component with Vue Slots
8:21
LearnVue
Рет қаралды 33 М.
Are You Following This Vue Best Practice?
2:43
LearnVue
Рет қаралды 86 М.
Dynamic Scroll States with Intersection Observer + Vue
5:41
LearnVue
Рет қаралды 31 М.
5 Ways to Fetch Data from an API in Vue 3 Composition API
6:28
Justin Brooks
Рет қаралды 78 М.
Vue Draggable by Daniel Kelly: Vue.js Nation 2023 Mighty Bites
3:57
An Easy Vue 3 Skeleton Loading Screen with Suspense
8:36
LearnVue
Рет қаралды 41 М.