Taro: 文档给出 `getCurrentInstance` 方法无法找到

Created on 3 Jul 2020  ·  2Comments  ·  Source: NervJS/taro


相关平台

微信小程序

复现仓库

https://taro-docs.jd.com/taro/docs/react/
小程序基础库: 2.11.3
使用框架: React

复现步骤

image
image

import { eventCenter, getCurrentInstance } from '@tarojs/taro' 爆红

vs code 提示无 getCurrentInstance 方法导出

期望结果

import { eventCenter, getCurrentInstance } from '@tarojs/taro'

不爆红

实际结果

爆红

环境信息

 Taro v3.0.2


  Taro CLI 3.0.2 environment info:
    System:
      OS: macOS 10.15.5
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 14.4.0 - /usr/local/bin/node
      Yarn: 1.22.0 - /usr/local/bin/yarn
      npm: 6.14.5 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.2 => 3.0.2 
      @tarojs/mini-runner: 3.0.2 => 3.0.2 
      @tarojs/react: 3.0.2 => 3.0.2 
      @tarojs/runtime: 3.0.2 => 3.0.2 
      @tarojs/taro: ^3.0.2 => 3.0.2 
      @tarojs/webpack-runner: 3.0.2 => 3.0.2 
      babel-preset-taro: 3.0.2 => 3.0.2 
      eslint-config-taro: 3.0.2 => 3.0.2 
      react: ^16.13.1 => 16.13.1 
    npmGlobalPackages:
      typescript: 3.9.5

A-typings V-3

Most helpful comment

在 @tarojs/runtime 包里, @tarojs/taro 包也是做了 re-export

All 2 comments

在 @tarojs/runtime 包里, @tarojs/taro 包也是做了 re-export

我也是按文档也没有找到,是否已经解决了问题

Was this page helpful?
0 / 5 - 0 ratings