Skip to content

Commit

Permalink
fix(runtime-core): this for nextTick, close vuejs#2282
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Oct 1, 2020
1 parent 985bd2b commit b0265ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/runtime-core/src/scheduler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ErrorCodes, callWithErrorHandling } from './errorHandling'
import { isArray } from '@vue/shared'
import { ComponentInternalInstance, currentInstance } from './component'

export interface SchedulerJob {
(): void
Expand Down Expand Up @@ -50,7 +51,7 @@ type CountMap = Map<SchedulerJob | SchedulerCb, number>

export function nextTick(fn?: () => void): Promise<void> {
const p = currentFlushPromise || resolvedPromise
return fn ? p.then(fn) : p
return fn ? p.then(fn.bind(currentInstance && currentInstance.proxy)) : p
}

export function queueJob(job: SchedulerJob) {
Expand Down

0 comments on commit b0265ff

Please sign in to comment.