1***@qq.com
1***@qq.com
  • 发布:2018-11-27 16:13
  • 更新:2018-11-27 16:41
  • 阅读:1173

Hello MUI的webview选项卡示例获得不到其dom

分类:HBuilder

想要获得webview选项卡的dom节点并且进行style的设置,但是一直获取不到他的节点,manifest中是这样写的,

"launchwebview": {  
            "bottom": "0px",  
            "background": "#fff",  
            "subNViews": [  
                {  
                    "id": "tabbar",  
                    "styles": {  
                        "bottom": "0px",  
                        "left": "0",  
                        "height": "50px",  
                        "width": "100%",  
                        "backgroundColor": "#fff"  
                    },  
                    "tags": [  
                        {  
                            "tag": "img",  
                            "id": "homeIcon",  
                            "src": "images/home.png",  
                            "position": {  
                                "top": "0px",  
                                "left": "15%",  
                                "width": "48px",  
                                "height": "48px"  
                            }  
                        },{  
                            "tag": "img",  
                            "id": "mineIcon",  
                            "src": "images/geren.png",  
                            "position": {  
                                "top": "0px",  
                                "left": "75%",  
                                "width": "48px",  
                                "height": "48px"  
                            }  
                        }  
                    ]  
                }  
            ]  
        },

并且在index.html中想要获取他的dom节点
document.getElementById("tabbar")
一直返回的是null,,请问如何获取正确节点呢?

2018-11-27 16:13 负责人:无 分享
已邀请:
回梦無痕

回梦無痕 - 暂停服务

这是View,不是html,没有DOM的。

//只能这样获取  
plus.nativeObj.View.getViewById("tabbar");
  • 1***@qq.com (作者)

    那这样的话,我想要动态改变他的样式,如何才能改变呢?

    2018-11-27 16:22

全村人的老司机

全村人的老司机 - 头像有缓存!不更新!你说气不气!

http://ask.dcloud.net.cn/article/1263

可以参考 这块貌似需要自己重构~

该问题目前已经被锁定, 无法添加新回复