NervJS/taro

view超过14层后createSelectorQuery的exec会返回null

Closed this issue · 2 comments

相关平台

微信小程序

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

复现步骤

新建taro 3.6.23 的项目,使用react框架和ts,Index页面改为:
import {View} from '@tarojs/components';
import Taro from '@tarojs/taro';

import './index.scss';

export default function Index() {

return (

<View>  {/*1*/}

  <button onClick = {async () => {

    const tmp = Taro.createSelectorQuery().select('.vvv1');
    console.log('tmp', tmp);

    const selectorQuery = tmp.fields({
      computedStyle: ['height'],
    });
    console.log('selectorQuery', selectorQuery);
    selectorQuery.exec((args) => {
      console.log('args', args);  //在第15层返回null,14层及以下都正常
    });
  }}>get
  </button>

  <View> {/*2*/}
    <View> {/*3*/}
      <View> {/*4*/}
        <View> {/*5*/}
          <View> {/*6*/}
            <View> {/*7*/}
              <View> {/*8*/}
                <View> {/*9*/}
                  <View> {/*10*/}
                    <View> {/*11*/}
                      <View> {/*12*/}
                        <View> {/*13*/}
                          <View> {/*14*/}
                            <View> {/*15*/}
                              <View className = "vvv1"></View>

                            </View>

                          </View>
                        </View>
                      </View>

                    </View>

                  </View>

                </View>

              </View>

            </View>

          </View>

        </View>

      </View>

    </View>

  </View>

</View>

);
}

期望结果

绑定vvv1的view在15层以上args也可以得到正确结果:
{height: "0px"}

实际结果

args的结果是[null]

环境信息

 Taro v3.6.23


  Taro CLI 3.6.23 environment info:
    System:
      OS: Windows Server 2012 6.3.9600
    Binaries:
      Node: 18.11.0 - C:\Program Files\nodejs\node.EXE
      npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.23 => 3.6.23
      @tarojs/components: 3.6.23 => 3.6.23
      @tarojs/helper: 3.6.23 => 3.6.23
      @tarojs/plugin-framework-react: 3.6.23 => 3.6.23
      @tarojs/plugin-html: ^3.6.23 => 3.6.23
      @tarojs/plugin-platform-alipay: 3.6.23 => 3.6.23
      @tarojs/plugin-platform-h5: 3.6.23 => 3.6.23
      @tarojs/plugin-platform-jd: 3.6.23 => 3.6.23
      @tarojs/plugin-platform-qq: 3.6.23 => 3.6.23
      @tarojs/plugin-platform-swan: 3.6.23 => 3.6.23
      @tarojs/plugin-platform-tt: 3.6.23 => 3.6.23
      @tarojs/plugin-platform-weapp: 3.6.23 => 3.6.23
      @tarojs/react: 3.6.23 => 3.6.23
      @tarojs/runtime: 3.6.23 => 3.6.23
      @tarojs/shared: 3.6.23 => 3.6.23
      @tarojs/taro: 3.6.23 => 3.6.23
      @tarojs/taro-loader: 3.6.23 => 3.6.23
      @tarojs/webpack5-runner: 3.6.23 => 3.6.23
      babel-preset-taro: 3.6.23 => 3.6.23
      eslint-config-taro: 3.6.23 => 3.6.23
      react: ^18.0.0 => 18.2.0

看下这个 issue

谢谢,看到了。测试了一下,h5没有这样的事。应该是和小程序本身有关。