vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core

Home Page:http://v2.vuejs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$forceUpdate causes getCurrentScope to get an incorrect value

1593292349 opened this issue · comments

Version

2.7.16-beta.2

Reproduction link

github.com

Steps to reproduce

1.npm install
2.npm run start
3.Execute the "getCurrentScope "method on the console, Get the correct value
4.Click the render button
5.Execute the "getCurrentScope "method on the console, Get the wrong value

What is expected?

The getCurrentScope method always returns undefined

What is actually happening?

The getCurrentScope method returns not undefined after calling the $forceUpdate method

image
The screen shot shows the return value of getCurrentScope, it may be the effect scope of current component?(App.vue component in your offered codebase), by the way, your new vue instance(vm) have not be mounted into the DOM(.$mount() haven't offer position reference to mount).

I found some new details,
image
when I place console.log(getCurrentScope()); at #1, the result including effects property, whose value is an array, have a item whose $el property is <div id='app'....> dom node, and when palced console.log(getCurrentScope()); at #2, in the same place, whose $el property is div node in vm component...