1***@qq.com
1***@qq.com
  • 发布:2024-08-08 11:20
  • 更新:2024-09-14 10:57
  • 阅读:496

【报Bug】uniapp使用小程序的xr-frame在父组件中引用的时候传递的width,height没有生效

分类:uni-app

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

PC开发环境操作系统: Windows

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

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

基础库版本号: 3.53

项目创建方式: CLI

CLI版本号: @vue/cli 5.0.8

示例代码:

新建一个xr-start组件
新建一个后缀名是.wxml的

<xr-scene id="xr-scene" bind:ready="handleReady">  
  <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded">  
    <xr-asset-load type="gltf" asset-id="gltf-just_a_girl" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/just_a_girl/index.glb" />  
  </xr-assets>  
  <xr-node>  
    <xr-node node-id="camera-target" position="0 0 0"></xr-node>  
    <xr-gltf node-id="gltf-just_a_girl" position="0 -0.5 0" rotation="0 0 0" scale="0.01 0.01 0.01" model="gltf-just_a_girl"></xr-gltf>  
    <xr-camera  
      id="camera" node-id="camera" position="0 0.4 1.6" clear-color="0.9 0.9 0.9 1"  
      target="camera-target"  
      camera-orbit-control=""  
    ></xr-camera>  
  </xr-node>  
  <xr-node node-id="lights">  
    <xr-light type="ambient" color="1 1 1" intensity="0.3" />  
    <xr-light type="directional" rotation="180 0 0" color="1 1 1" intensity="2" />  
  </xr-node>  
</xr-scene>

新建一个后缀名是.json的

{  
  "component": true,  
  "renderer": "xr-frame",  
  "usingComponents": {}  
}

新建一个后缀名是.js的

Component({  
    behaviors: [require('../common/share-behavior').default],  
    properties: {  
        a: Number,  
    },  
    data: {  
        loaded: false  
    },  
    lifetimes: {},  
    methods: {  
        handleReady({detail}) {  
            const xrScene = this.scene = detail.value  
            console.log('xr-scene', xrScene)  
        },  
        handleAssetsProgress: function({detail}) {  
            console.log('assets progress', detail.value)  
        },  
        handleAssetsLoaded: function({detail}) {  
            console.log('assets loaded', detail.value)  
            this.setData({loaded: true})  
        },  
        handleRaf: function({detail}) {  
            console.log('raf', detail.value)  
        }  
    }  
})

test.vue页面引入改组件

<template lang="pug">  
view.test  
  xr-start#main-frame(  
    disable-scroll  
    :url="testSrc"  
    :width="renderWidth"  
    :height="renderHeight"  
    :style="{width:`${width}px`, height:`${height}px`, display: 'block'}"  
  )  

</template>

打包后上面的width和height都没有展示在标签上,被删除

操作步骤:

按照小程序官方xr-frame文档操作就可以复现,出来的3d模型模糊,就是width和height没有设置成功的问题

预期结果:

能够设置width和height

实际结果:

不能够设置width和height

bug描述:

使用xr-frame在父组件里面引入设置width和height没有生效,打包后属性都没有打包上去,直接删除掉了```javascript <template lang="pug"> view.test xr-start#main-frame( disable-scroll url="testSrc" width="renderWidth" height="renderHeight" style="{width:${width}px, height:${height}px, display: 'block'}" )

</template>

2024-08-08 11:20 负责人:无 分享
已邀请:
BFC

BFC

可以临时在 // node_modules\@dcloudio\uni-mp-weixin\dist\uni.compiler.js 文件, customElements 数组内多加一个 'xr-start' 标签解决

  • 2***@qq.com

    无@dcloudio\uni-mp-weixin\dist\uni.compiler.js 怎么操作

    2024-08-27 17:16

  • BFC

    回复 2***@qq.com: cli项目的话,就在根目录 node_modules找起,如果是hbuilderX项目的话,可以从hbuilder应该的目录下,从\plugins\uniapp-cli-vite\node_modles 目录找起

    2024-08-27 23:15

  • 1***@qq.com

    回复 BFC: 按照这个办法解决了,感谢,请问这个bug 什么时候修复

    2024-09-10 16:43

  • 1***@qq.com (作者)

    好的,谢谢

    2024-09-11 11:48

  • 1***@qq.com

    回复 BFC: "应该的目录下"是什么意思

    2024-09-11 16:17

  • BFC

    回复 1***@qq.com: 不好意思,写错了, 是hbuilder应用的安装目录

    2024-09-11 16:58

BFC

BFC

你好,已确认bug, 感谢反馈。

BFC

BFC

HBuilderX 版本 4.27.2024091308-alpha 已修复

要回复问题请先登录注册