2***@qq.com
2***@qq.com
  • 发布:2023-09-27 20:19
  • 更新:2024-01-06 10:45
  • 阅读:428

【报Bug】uniapp subnvue 中是用map的方法 getRegion getCenterLocation等方法不启用

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 3.7.12

手机系统: Android

手机系统版本号: Android 14

手机厂商: OPPO

手机机型: oppo reno8 pro+

页面类型: nvue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

//pages.json
{
"path": "pages/account/index",
"style": {
"navigationBarTitleText": "个人中心",
"app-plus": {
"titleNView":{
"autoBackButton":false
},
"subNVues": [
{
"id": "map",
"path": "pages/account/map",
"style": {
"bottom": "0px",
"width": "100%",//宽度为屏幕宽度
"height": "500upx"//高度可调整
}
}
]
}
}
}

<map id="map" ref="map" :scale="map.scale" @regionchange="regionchange"
@updated="updated" :latitude="map.latitude" :longitude="map.longitude" :markers="covers" @callouttap="de" @markertap="de">
</map>

    onReady() {  
        console.log('---reday')  
                   //这里走了  
        // 创建地图上下文  
        map = uni.createMapContext('map', this);  

        map.getRegion({  
            success: res => {  
                                   //这里进不来  
                    console.log(22132321);  
                    console.log(22132321);  
            }  

        })  
    },

操作步骤:

//pages.json
{
"path": "pages/account/index",
"style": {
"navigationBarTitleText": "个人中心",
"app-plus": {
"titleNView":{
"autoBackButton":false
},
"subNVues": [
{
"id": "map",
"path": "pages/account/map",
"style": {
"bottom": "0px",
"width": "100%",//宽度为屏幕宽度
"height": "500upx"//高度可调整
}
}
]
}
}
}

<map id="map" ref="map" :scale="map.scale" @regionchange="regionchange"
@updated="updated" :latitude="map.latitude" :longitude="map.longitude" :markers="covers" @callouttap="de" @markertap="de">
</map>

    onReady() {  
        console.log('---reday')  
                   //这里走了  
        // 创建地图上下文  
        map = uni.createMapContext('map', this);  

        map.getRegion({  
            success: res => {  
                                   //这里进不来  
                    console.log(22132321);  
                    console.log(22132321);  
            }  

        })  
    },

预期结果:

预期可以使用地图的方法,并返回结果。

实际结果:

使用不报错,但是方法走不进去,不执行

bug描述:

uniapp subnvue 中是用map的方法 getRegion getCenterLocation等方法不启作用

2023-09-27 20:19 负责人:无 分享
已邀请:
hzpb2013

hzpb2013

我也遇到同样的问题了,您解决好了吗?

要回复问题请先登录注册