vue-draggable-plus icon indicating copy to clipboard operation
vue-draggable-plus copied to clipboard

add onstart callback fetaure

Open 2ue opened this issue 1 year ago • 5 comments

In the onStart method, you may need to interrupt dragging or placing elements, or rendering and placing elements requires obtaining data from the terminal, so the following is added:

  1. Allow the clone method to be an asynchronous function
  2. Add the return type of clone method: Promise and false can be returned. When false is returned, it will not be updated.

2ue avatar Aug 20 '24 07:08 2ue

Deploy Preview for vue-draggable-plus ready!

Name Link
Latest commit a04e1d8f1d8eddb8d7987e0163ca1c67b836a711
Latest deploy log https://app.netlify.com/sites/vue-draggable-plus/deploys/677e2ee34afa570008b7c484
Deploy Preview https://deploy-preview-182--vue-draggable-plus.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Aug 20 '24 07:08 netlify[bot]

This asynchronous behavior may lead to the correct value not being obtained if the promise has not been resolved when the update is triggered.

Alfred-Skyblue avatar Aug 20 '24 07:08 Alfred-Skyblue

This asynchronous behavior may lead to the correct value not being obtained if the promise has not been resolved when the update is triggered.

This asynchronous behavior may lead to the correct value not being obtained if the promise has not been resolved when the update is triggered.

Yes. I've updated this method to use Promise. resolve to ensure the return value is as expected

2ue avatar Aug 21 '24 02:08 2ue

If it's asynchronous, then no other events should be triggered before the promise is resolved. If that's the case, it could cause the view to be blocked, which I personally think is not a reasonable requirement.

Alfred-Skyblue avatar Aug 23 '24 06:08 Alfred-Skyblue

If it's asynchronous, then no other events should be triggered before the promise is resolved. If that's the case, it could cause the view to be blocked, which I personally think is not a reasonable requirement.

Yes. Asynchronous may cause render to be blocked(maybe blocked to be wanted really?). We can also render page by asynchronous data after the element is placed, but it will cause rendered twice. Is it bad? so I want to solve it on start.

In fact, delayed rendering after dragging (may need to be combined with remote data for page rendering, may require the user to input again for confirmation, etc.) is also a normal requirement. For example

  1. Drag and drop to render remote components
  2. Before placed, user needs to input some information.
  3. Remote data needs to be verified before be placed.

2ue avatar Aug 26 '24 07:08 2ue