折七
折七
  • 发布:2023-10-31 14:11
  • 更新:2023-10-31 17:14
  • 阅读:533

【报Bug】在skyline页面 使用组件的boundingClientRect的回调不执行

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Windows

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

第三方开发者工具版本号: Nightly 1.06.2310272

基础库版本号: 3.1.5

项目创建方式: CLI

CLI版本号: Vue3/Vite latest & alpha

示例代码:
<script setup lang="ts">  
// xxx.vue 组件  
import { onMounted, getCurrentInstance } from 'vue';  

const proxy = getCurrentInstance()!.proxy  
onMounted(() => {  
  uni.createSelectorQuery()  
    .in(proxy)  
    .select('#ads')  
    .boundingClientRect((res) => {  
      console.log(res)  
    })  
    .exec()  
})  
</script>  

<template>  
  <view>  
    <view id="ads" class="ads"></view>  
  </view>  
</template>

操作步骤:

pages.json

"pages": [   
        {  
            "path": "pages/index/index",  
            "style": {  
                "navigationBarTitleText": "uni-app",  
        "navigationStyle": "custom",  
        "renderer": "skyline",  
        "componentFramework": "glass-easel"  
            }  
        }  
    ],

manifest.json

 "mp-weixin" : {  
        "appid" : "",  
        "lazyCodeLoading": "requiredComponents",  
        "rendererOptions": { "skyline": { "defaultDisplayBlock": true } },  
        "setting" : {  
            "urlCheck" : false  
        },  
        "usingComponents" : true  
    },

在component 中创建xxx.vue文件 在pages/index/index.vue 引入xxx.vue组件

微信小程序开发工具 -> 详情 -> 本地设置 -> 开启skyline

在原生中使用的this而在uniapp中使用的proxy
加了in(proxy)之后不执行回调,而不加能打印null,在组件中不能不加组件实例

预期结果:

打印元素信息对象

实际结果:

不执行回调

bug描述:

在skyline页面 使用组件 通过uni.createSelectorQuery()获取元素信息的时候不执行boundingClientRect的回调

而webview中有效,原生微信小程序skyline有效

2023-10-31 14:11 负责人:无 分享
已邀请:
zZZ1Ma

zZZ1Ma

微信原生语法中输出 this.createSelectorQuery().select('#ads')试试能否获取到Node

  • 折七 (作者)

    原生当中this.createSelectorQuery().select('#ads')这种语法可以但是in(this)又不行了,等下我去微信那边反馈,我记得昨天还是能够打印的不知道是我记错了还是什么

    2023-11-01 10:37

  • 折七 (作者)

    const proxy = getCurrentInstance()?.proxy as any  
    onMounted(async () => {
    proxy
    .createSelectorQuery()
    .select('#notice-bar-scroll-view')
    .boundingClientRect((res: any) => {
    console.log(res)
    })
    .exec()
    })

    确定了是微信那边的问题换成这种方式可以获取,昨天不知道为什么不行但是今天又行了

    2023-11-01 10:57

要回复问题请先登录注册