oncream
oncream
  • 发布:2020-07-07 19:38
  • 更新:2020-07-08 09:00
  • 阅读:584

运行到手机和打包到手机出现异议

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 2.7.14

手机系统: Android

手机系统版本号: Android 8.1

手机厂商: vivo

手机机型: x9s plus

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

App下载地址或H5⽹址: https://service.dcloud.net.cn/build/download/9fc1a7e0-c043-11ea-8fb8-29f5d3059713

示例代码:

操作步骤:

1

预期结果:

1

实际结果:

1

bug描述:

我得功能是一个获取本地位置的测试,从hbuilder 应用运行到手机端能正常使用,但是打包就用不了。获取无响应。确定无误 不是代码问题

  1. png 是hbuilder X 运行到手机端可以正常使用
  2. png 是打包到手机,无法使用,定位开了的。
    
    <template>  
    <view class="container">  
        <view>country {{address.country}}</view>  
        <view>province {{address.province}}</view>  
        <view>city {{address.city}}</view>  
        <view>district {{address.district}}</view>  
        <view>street {{address.street}}</view>  
        <view>streetNum {{address.streetNum}}</view>  
        <view>poiName {{address.poiName}}</view>  
        <view>postalCode {{address.postalCode}}</view>  
        <view>cityCode {{address.cityCode}}</view>  
        <view class="">  
            {{address}}  
        </view>  
        <view v-if="error != ''">{{error}}</view>  
        <input v-if="location!=''" type="text" v-model="location" />  
        <button type="default" @click="getlocation" >获取位置</button>  
    </view>  
    </template>  

<script>
export default {
data() {
return {
location:"",
address:"",
info:"",
error:''
}
},
methods: {
getlocation(){
var that = this;
uni.getLocation({
geocode:true,
type:'gcj02',
success(res){
console.log(res)
that.address=res.address
that.location='经纬度:'+res.longitude+','+res.latitude
},fail(res) {
that.error=res
},
complete(res){
that.error=res
}
})
}
}
}
</script>

<style>
.container {
padding: 20px;
font-size: 14px;
line-height: 24px;
}
</style>

2020-07-07 19:38 负责人:无 分享
已邀请:
口区

口区 -

https://ask.dcloud.net.cn/article/29
需要申请高德或者百度的key

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