vuejs / composition-api

Composition API plugin for Vue 2
https://composition-api.vuejs.org/
MIT License
4.19k stars 343 forks source link

setup使用getCurrentInstance()返回的对象是null #953

Closed seafronthu closed 2 years ago

seafronthu commented 2 years ago
setup() {
    alert(1);   // 弹了两次
    const  instance = getCurrentInstance();
    console.log(instance)  // 结果是null 
    // do something
    return {}
}

@vue/composition-api版本:1.7.0 (还原到1.4.4正常) vue版本:2.6.11

antfu commented 2 years ago

We temporarily close this due to the lack of enough information. Please provide a minimal reproduction to reopen the issue. Thanks.

Why reproduction is required