1***@qq.com
1***@qq.com
  • 发布:2023-12-22 14:26
  • 更新:2023-12-22 14:26
  • 阅读:204

subnvue在page.json中不设置宽度,在页面中使用setStyle的方式设置或修改宽高背景色都不起作用

分类:uni-app

pages.json中配置:

 {  
                    "path": "courseDetail/courseDetail",  
                    "style": {  
                        "navigationBarTitleText": "课程详情",  
                        "enablePullDownRefresh": false,  
                        "app-plus": {  
                            "statusbar": {  
                                "immersed": false  
                            },  
                            "titleNView": false,  
                            "subNVues": [{  
                                "id": "videoPlayer",  
                                "path": "courseDetail/VideoPlayerViewComponent", // nvue 路径  
                                "style": {  
                                    "position": "static",  
                                    // "dock": "top",  
                                    "width": "0",  
                                    "height": "200px",  
                                    "left": "0",  
                                    "top": "0",  
                                    "zIndex": "1",  
                                    "background": "transparent"  
                                }  
                            }]  
                        }  
                    }  
                }

页面中使用:

const { screenWidth, screenHeight } = uni.getSystemInfoSync();  
that.subNVue = uni.getSubNVueById('videoPlayer');  
that.subNVue.setStyle({  
    position: 'static',  
    background: '#333333',  
    width: screenWidth + 'px',  
    height: '200px',  
    left: '0',  
    top: '0'  
});  
that.subNVue.show();
2023-12-22 14:26 负责人:无 分享
已邀请:

要回复问题请先登录注册