Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery-like API 错误 #6871

Closed
benny-eu opened this issue Jul 2, 2020 · 2 comments · Fixed by #6884
Closed

jQuery-like API 错误 #6871

benny-eu opened this issue Jul 2, 2020 · 2 comments · Fixed by #6884
Labels
P-1 High, patch
Milestone

Comments

@benny-eu
Copy link

benny-eu commented Jul 2, 2020

相关平台

微信小程序

小程序基础库: 2.11.3
使用框架: React

复现步骤

import React, { useEffect } from "react";
import { $ } from "@tarojs/extend";

const Index = () => {
  useEffect(() => {
    $(".box")
      .height()
      .then((res) => console.log(res));
  }, []);

  return (
    <View className='box'>
      test
    </View>
  );
}

export default Index;

期望结果

正确获取高度

实际结果

Cannot read property 'left' of null
TypeError: Cannot read property 'left' of null

环境信息

Taro CLI 3.0.2 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
      Yarn: 1.22.0 - /usr/local/bin/yarn
      npm: 6.13.4 - ~/.nvm/versions/node/v10.16.0/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.10.0 => 16.13.1 
      taro-ui: 3.0.0-alpha.2 => 3.0.0-alpha.2
@yuche yuche added P-1 High, patch and removed P-1 High, patch labels Jul 2, 2020
@taro-bot taro-bot bot added this to the 3.0.3 milestone Jul 2, 2020
@yuche
Copy link
Contributor

yuche commented Jul 2, 2020

8816c02 修复了这个问题,
如果使用 Hooks 的话需要在 useReady 的 callback 才能访问到真实 DOM 的参数(jQuery 返回 Promise 的方法)

@liuhuapiaoyuan
Copy link

现在3.0.5依然还是一样的错误 并没有被修复啊?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-1 High, patch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants