使用
var that = this
uni.chooseLocation({
success: (res) => {
if (type == 0) {
that.formData.startAddress = res.name
that.formData.startLocation = res.latitude + "," + res.longitude
} else if (type == 1) {
that.formData.endAddress = res.name
that.formData.endLocation = res.latitude + "," + res.longitude
}
//that.mapChange()
}
})
报错
[JS Framework] Failed to execute the callback function:
TypeError: Cannot read property 'pageIndex' of null
16:46:06.600 reportJSException >>>> exception function:WEEX_CALL_JAVASCRIPT, exception:JavaScript execute error!Uncaught TypeError: Cannot read property 'pageIndex' of null
at (/__uniappchooselocation.js.nvue:32:16971)
- 发布:2025-11-10 16:50
- 更新:2025-11-10 16:50
- 阅读:22
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 25H2
HBuilderX类型: 正式
HBuilderX版本号: 4.85
手机系统: Android
手机系统版本号: Android 13
手机厂商: 小米
手机机型: civi
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
var that = this
uni.chooseLocation({
success: (res) => {
if (type == 0) {
that.formData.startAddress = res.name
that.formData.startLocation = res.latitude + "," + res.longitude
} else if (type == 1) {
that.formData.endAddress = res.name
that.formData.endLocation = res.latitude + "," + res.longitude
}
//that.mapChange()
}
})
var that = this
uni.chooseLocation({
success: (res) => {
if (type == 0) {
that.formData.startAddress = res.name
that.formData.startLocation = res.latitude + "," + res.longitude
} else if (type == 1) {
that.formData.endAddress = res.name
that.formData.endLocation = res.latitude + "," + res.longitude
}
//that.mapChange()
}
})
预期结果:
返回选择地址信息
返回选择地址信息
实际结果:
[JS Framework] Failed to execute the callback function:
TypeError: Cannot read property 'pageIndex' of null
16:46:06.600 reportJSException >>>> exception function:WEEX_CALL_JAVASCRIPT, exception:JavaScript execute error!Uncaught TypeError: Cannot read property 'pageIndex' of null
at (/__uniappchooselocation.js.nvue:32:16971)
[JS Framework] Failed to execute the callback function:
TypeError: Cannot read property 'pageIndex' of null
16:46:06.600 reportJSException >>>> exception function:WEEX_CALL_JAVASCRIPT, exception:JavaScript execute error!Uncaught TypeError: Cannot read property 'pageIndex' of null
at (/__uniappchooselocation.js.nvue:32:16971)
bug描述:
使用chooseLocation报错
0 个回复