5***@qq.com
5***@qq.com
  • 发布:2021-06-26 23:34
  • 更新:2022-07-26 17:09
  • 阅读:1820

【报Bug】App端 TypeError: uni.createSelectorQuery(...).select(...).node is not a function 无法获取节点方法

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: WIN7

HBuilderX类型: 正式

HBuilderX版本号: 3.1.18

手机系统: Android

手机系统版本号: Android 9.0

手机厂商: 一加

手机机型: 一加6

页面类型: vue

打包方式: 离线

项目创建方式: HBuilderX

示例代码:
<template>  
    <view class="content">  
        <canvas id="c1" type="2d" style="display: inline-block; width: 300px; height: 300px;background-color: #007AFF;"></canvas>  
        <view class="text-class">  
            获取节点信息(直接运行到手机获取不到节点信息/但微信小程序可以)  
        </view>  
        <view class="text-class" :style="{'color':bgColor}">  
            {{title}}  
        </view>  
        <button @click="test()" type="primary">测试</button>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
                title: '--',  
                bgColor: "#007AFF"  
            }  
        },  
        onLoad() {  

        },  
        methods: {  
            test(){  
                try{  
                    this.bgColor = "#007AFF"  
                    uni.createSelectorQuery().select('#c1').node(res => {  
                        console.info(JSON.stringify(res.node))  
                        this.title = JSON.stringify(res.node)  
                    }).exec()  
                }catch(error){  
                    console.info("出现异常了",error)  
                    this.bgColor = "#FF0000"  
                    this.title = "出现异常了"+error  
                }  

            }  
        }  
    }  
</script>  

<style>  
    .content {  
        display: flex;  
        flex-direction: column;  
        align-items: center;  
        justify-content: center;  
        margin: 10rpx auto;  
    }  

    .canvas-class{  
        width: 300rpx;  
        height: 300rpx;  
    }  

    .text-class {  
        margin: 10rpx;  
        padding: 10rpx;  
        width: 100%;  
    }  
</style>  

操作步骤:

分别运行在 微信小城 及 直接运行到手机

预期结果:

小程序点击测试 成功获取到节点
App 成功获取到节点

实际结果:

小程序点击测试 成功获取到节点
App 获取失败

bug描述:

TypeError: uni.createSelectorQuery(...).select(...).node is not a function

在微信小程序平台上,node 节点可以正常获取,但是App无法成功获取

附件中附带了 复现的Demo,请查收

2021-06-26 23:34 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com

请问问题解决了吗?我这边也遇到这样问题了

苍山暮色烟雨迟

苍山暮色烟雨迟

请问问题解决了吗?我这边也遇到这样问题了

2***@qq.com

2***@qq.com

app 不支持 .node, 有没有其他代替方法

要回复问题请先登录注册