![oncream](https://img-cdn-tc.dcloud.net.cn/account/identicon/359fc69195bb34c8146f2eae7f44b5e4.png)
- 发布:2020-07-07 19:38
- 更新:2020-07-08 09:00
- 阅读:584
产品分类: 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
1
实际结果:
1
1
bug描述:
我得功能是一个获取本地位置的测试,从hbuilder 应用运行到手机端能正常使用,但是打包就用不了。获取无响应。确定无误 不是代码问题
- png 是hbuilder X 运行到手机端可以正常使用
- 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>
![](http://img-cdn-tc.dcloud.net.cn/uploads/questions/20200707/e40c494ff2a144968be3a98dddd10d1e.png)
![](http://img-cdn-tc.dcloud.net.cn/uploads/questions/20200707/befc4962e513da1b0a9338058582b7d6.png)
![](http://img-cdn-tc.dcloud.net.cn/uploads/questions/20200707/2c9d90961377c99060628b5ffdde9172.png)