From b0265ff749f90bb837ff9c57d3eae84842ae3a16 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 2 Oct 2020 00:28:33 +0800 Subject: [PATCH] fix(runtime-core): this for nextTick, close #2282 --- packages/runtime-core/src/scheduler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/scheduler.ts b/packages/runtime-core/src/scheduler.ts index 9c90f5c53b5..1214ebb98f3 100644 --- a/packages/runtime-core/src/scheduler.ts +++ b/packages/runtime-core/src/scheduler.ts @@ -1,5 +1,6 @@ import { ErrorCodes, callWithErrorHandling } from './errorHandling' import { isArray } from '@vue/shared' +import { ComponentInternalInstance, currentInstance } from './component' export interface SchedulerJob { (): void @@ -50,7 +51,7 @@ type CountMap = Map export function nextTick(fn?: () => void): Promise { 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) {