Skip to content

Commit

Permalink
fix: created asynchronously when currentInstance is not obtained
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred-Skyblue committed Dec 6, 2023
1 parent 3112c93 commit 5789303
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/useDraggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
removeElement,
removeNode
} from './utils'
import { watch } from 'vue'
import { nextTick, watch } from 'vue'

function defaultClone<T>(element: T): T {
if (element === undefined || element === null) return element
Expand All @@ -47,7 +47,7 @@ function tryOnUnmounted(fn: Fn) {
*/
function tryOnMounted(fn: Fn) {
if (getCurrentInstance()) onMounted(fn)
else fn()
else nextTick(fn)
}

const CLONE_ELEMENT_KEY = Symbol('cloneElement')
Expand Down

0 comments on commit 5789303

Please sign in to comment.